summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-20 13:07:19 +0100
committerErik Johnston <erik@matrix.org>2015-05-20 13:07:19 +0100
commitab45e12d31bf8238c3cb1887d18d89ae2addbb7a (patch)
treeaa0f7e797ce21e13fe8b7e06e2476d261440e636 /synapse/storage/events.py
parentPEP8 (diff)
downloadsynapse-ab45e12d31bf8238c3cb1887d18d89ae2addbb7a.tar.xz
Make not return a deferred _get_event_from_row_txn
Diffstat (limited to '')
-rw-r--r--synapse/storage/events.py25
1 files changed, 5 insertions, 20 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 3f7f546bdd..4aa4e7ab15 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -723,23 +723,8 @@ class EventsStore(SQLBaseStore):
         d = json.loads(js)
         internal_metadata = json.loads(internal_metadata)
 
-        def select(txn, *args, **kwargs):
-            if txn:
-                return self._simple_select_one_onecol_txn(txn, *args, **kwargs)
-            else:
-                return self._simple_select_one_onecol(
-                    *args,
-                    desc="_get_event_from_row", **kwargs
-                )
-
-        def get_event(txn, *args, **kwargs):
-            if txn:
-                return self._get_event_txn(txn, *args, **kwargs)
-            else:
-                return self.get_event(*args, **kwargs)
-
         if rejected_reason:
-            rejected_reason = yield select(
+            rejected_reason = self._simple_select_one_onecol_txn(
                 txn,
                 table="rejections",
                 keyvalues={"event_id": rejected_reason},
@@ -755,7 +740,7 @@ class EventsStore(SQLBaseStore):
         if check_redacted and redacted:
             ev = prune_event(ev)
 
-            redaction_id = yield select(
+            redaction_id = self._simple_select_one_onecol_txn(
                 txn,
                 table="redactions",
                 keyvalues={"redacts": ev.event_id},
@@ -765,7 +750,7 @@ class EventsStore(SQLBaseStore):
             ev.unsigned["redacted_by"] = redaction_id
             # Get the redaction event.
 
-            because = yield get_event(
+            because = self._get_event_txn(
                 txn,
                 redaction_id,
                 check_redacted=False
@@ -775,7 +760,7 @@ class EventsStore(SQLBaseStore):
                 ev.unsigned["redacted_because"] = because
 
         if get_prev_content and "replaces_state" in ev.unsigned:
-            prev = yield get_event(
+            prev = self._get_event_txn(
                 txn,
                 ev.unsigned["replaces_state"],
                 get_prev_content=False,
@@ -787,7 +772,7 @@ class EventsStore(SQLBaseStore):
             ev.event_id, check_redacted, get_prev_content, ev
         )
 
-        defer.returnValue(ev)
+        return ev
 
     def _parse_events(self, rows):
         return self.runInteraction(