summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-07-25 11:56:00 +0100
committerGitHub <noreply@github.com>2018-07-25 11:56:00 +0100
commitcee1ae1b72bcbf5d173ca2f5eef5e947cc5e69f7 (patch)
treece6789d45874397255e53623f665bb5ad7264d6f /synapse/storage/events.py
parentMerge pull request #3607 from matrix-org/rav/fix_persist_events_integrity_error (diff)
parentFix another logcontext leak in _persist_events (diff)
downloadsynapse-cee1ae1b72bcbf5d173ca2f5eef5e947cc5e69f7.tar.xz
Merge pull request #3606 from matrix-org/rav/logcontext_fixes_once_more
Fix another logcontext leak in _persist_events
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index f7c4226ea2..d39796f5ba 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -142,15 +142,14 @@ class _EventPeristenceQueue(object):
             try:
                 queue = self._get_drainining_queue(room_id)
                 for item in queue:
-                    # handle_queue_loop runs in the sentinel logcontext, so
-                    # there is no need to preserve_fn when running the
-                    # callbacks on the deferred.
                     try:
                         ret = yield per_item_callback(item)
+                    except Exception:
+                        with PreserveLoggingContext():
+                            item.deferred.errback()
+                    else:
                         with PreserveLoggingContext():
                             item.deferred.callback(ret)
-                    except Exception:
-                        item.deferred.errback()
             finally:
                 queue = self._event_persist_queues.pop(room_id, None)
                 if queue: