summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-04-12 11:19:10 +0100
committerErik Johnston <erik@matrix.org>2016-04-12 11:19:32 +0100
commitcccf86dd05a72f87aaf6fe288c700697954a2144 (patch)
tree05f23b960c59cc8ddcb834dadf11a42370e55a04 /synapse/storage
parentFix the rule_id for .m.rule.invite_for_me (#715) (diff)
downloadsynapse-cccf86dd05a72f87aaf6fe288c700697954a2144.tar.xz
Check if we've already backfilled events
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/events.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 308a2c9b02..f847c161af 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -543,6 +543,22 @@ class EventsStore(SQLBaseStore):
             (event.event_id, event.redacts)
         )
 
+    @defer.inlineCallbacks
+    def have_events_in_timeline(self, event_ids):
+        """Given a list of event ids, check if we have already processed and
+        stored them as non outliers.
+        """
+        rows = yield self._simple_select_many_batch(
+            table="events",
+            retcols=("event_id",),
+            column="event_id",
+            iterable=list(event_ids),
+            keyvalues={"outlier": False},
+            desc="have_events_in_timeline",
+        )
+
+        defer.returnValue(set(r["event_id"] for r in rows))
+
     def have_events(self, event_ids):
         """Given a list of event ids, check if we have already processed them.