summary refs log tree commit diff
path: root/synapse/replication
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-04-16 14:37:06 +0100
committerGitHub <noreply@github.com>2020-04-16 14:37:06 +0100
commitd7d42387f5788ca31b1db6309cb30ff180b8a22c (patch)
tree1961fd2c06178dd2a0d3245524cf332536cb068a /synapse/replication
parentConvert auth handler to async/await (#7261) (diff)
downloadsynapse-d7d42387f5788ca31b1db6309cb30ff180b8a22c.tar.xz
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)
Diffstat (limited to 'synapse/replication')
-rw-r--r--synapse/replication/tcp/streams/_base.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/replication/tcp/streams/_base.py b/synapse/replication/tcp/streams/_base.py
index f56a0fd4b5..0d3f050776 100644
--- a/synapse/replication/tcp/streams/_base.py
+++ b/synapse/replication/tcp/streams/_base.py
@@ -148,8 +148,9 @@ def db_query_to_update_function(
         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