Fix 'generator object is not subscriptable' error (#7290)

Some of the query functions return generators rather than lists, so we can't
index into the result. Happily we already have a copy of the results.

(think this was introduced in #7024)
This commit is contained in:
Richard van der Hoff 2020-04-16 14:37:06 +01:00 committed by GitHub
parent eed7c5b89e
commit d7d42387f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

1
changelog.d/7290.misc Normal file
View File

@ -0,0 +1 @@
Move catchup of replication streams logic to worker.

View File

@ -148,8 +148,9 @@ def db_query_to_update_function(
updates = [(row[0], row[1:]) for row in rows] updates = [(row[0], row[1:]) for row in rows]
limited = False limited = False
if len(updates) == limit: if len(updates) == limit:
upto_token = rows[-1][0] upto_token = updates[-1][0]
limited = True limited = True
assert len(updates) <= limit
return updates, upto_token, limited return updates, upto_token, limited