Skip to content

Commit

Permalink
Fix 'generator object is not subscriptable' error (matrix-org#7290)
Browse files Browse the repository at this point in the history
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 matrix-org#7024)
  • Loading branch information
richvdh authored and phil-flex committed Jun 16, 2020
1 parent 364cd11 commit f5ca692
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/7290.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move catchup of replication streams logic to worker.
3 changes: 2 additions & 1 deletion synapse/replication/tcp/streams/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ async def update_function(from_token, upto_token, limit):
updates = [(row[0], row[1:]) for row in rows]
limited = False
if len(updates) == limit:
upto_token = rows[-1][0]
upto_token = updates[-1][0]
limited = True
assert len(updates) <= limit

return updates, upto_token, limited

Expand Down

0 comments on commit f5ca692

Please sign in to comment.