summary refs log tree commit diff
path: root/synapse/storage/stream.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2018-05-09 16:02:13 +0100
committerGitHub <noreply@github.com>2018-05-09 16:02:13 +0100
commita5c98dda4890d19db5de5b7826219c0f88f467e4 (patch)
treecda316a97bc6538074c66cb6267ce23f0793ec78 /synapse/storage/stream.py
parentMerge pull request #3196 from matrix-org/erikj/pagination_return (diff)
parentMerge branch 'develop' of github.com:matrix-org/synapse into erikj/remove_mem... (diff)
downloadsynapse-a5c98dda4890d19db5de5b7826219c0f88f467e4.tar.xz
Merge pull request #3200 from matrix-org/erikj/remove_membership_change
 Remove unused code path from member change DB func
Diffstat (limited to 'synapse/storage/stream.py')
-rw-r--r--synapse/storage/stream.py34
1 files changed, 10 insertions, 24 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index 60d2dca154..0e313ec8f2 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -304,10 +304,7 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
 
     @defer.inlineCallbacks
     def get_membership_changes_for_user(self, user_id, from_key, to_key):
-        if from_key is not None:
-            from_id = RoomStreamToken.parse_stream_token(from_key).stream
-        else:
-            from_id = None
+        from_id = RoomStreamToken.parse_stream_token(from_key).stream
         to_id = RoomStreamToken.parse_stream_token(to_key).stream
 
         if from_key == to_key:
@@ -321,26 +318,15 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
                 defer.returnValue([])
 
         def f(txn):
-            if from_id is not None:
-                sql = (
-                    "SELECT m.event_id, stream_ordering FROM events AS e,"
-                    " room_memberships AS m"
-                    " WHERE e.event_id = m.event_id"
-                    " AND m.user_id = ?"
-                    " AND e.stream_ordering > ? AND e.stream_ordering <= ?"
-                    " ORDER BY e.stream_ordering ASC"
-                )
-                txn.execute(sql, (user_id, from_id, to_id,))
-            else:
-                sql = (
-                    "SELECT m.event_id, stream_ordering FROM events AS e,"
-                    " room_memberships AS m"
-                    " WHERE e.event_id = m.event_id"
-                    " AND m.user_id = ?"
-                    " AND stream_ordering <= ?"
-                    " ORDER BY stream_ordering ASC"
-                )
-                txn.execute(sql, (user_id, to_id,))
+            sql = (
+                "SELECT m.event_id, stream_ordering FROM events AS e,"
+                " room_memberships AS m"
+                " WHERE e.event_id = m.event_id"
+                " AND m.user_id = ?"
+                " AND e.stream_ordering > ? AND e.stream_ordering <= ?"
+                " ORDER BY e.stream_ordering ASC"
+            )
+            txn.execute(sql, (user_id, from_id, to_id,))
 
             rows = [_EventDictReturn(row[0], None, row[1]) for row in txn]