diff options
author | Erik Johnston <erik@matrix.org> | 2019-09-27 15:11:14 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-09-27 15:11:14 +0100 |
commit | 132279a46fd76de8f767bc6977192900c450fec9 (patch) | |
tree | 3487a0848149bce40e1016d1e48c298ee15b1aba /synapse/storage | |
parent | Move lookup-related functions from RoomMemberHandler to IdentityHandler (#5978) (diff) | |
download | synapse-132279a46fd76de8f767bc6977192900c450fec9.tar.xz |
Patch inlinecallbacks for log contexts
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/_base.py | 7 | ||||
-rw-r--r-- | synapse/storage/push_rule.py | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index abe16334ec..06cc14fcd1 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -30,7 +30,7 @@ from prometheus_client import Histogram from twisted.internet import defer from synapse.api.errors import StoreError -from synapse.logging.context import LoggingContext, PreserveLoggingContext +from synapse.logging.context import LoggingContext, make_deferred_yieldable from synapse.metrics.background_process_metrics import run_as_background_process from synapse.storage.engines import PostgresEngine, Sqlite3Engine from synapse.types import get_domain_from_id @@ -550,8 +550,9 @@ class SQLBaseStore(object): return func(conn, *args, **kwargs) - with PreserveLoggingContext(): - result = yield self._db_pool.runWithConnection(inner_func, *args, **kwargs) + result = yield make_deferred_yieldable( + self._db_pool.runWithConnection(inner_func, *args, **kwargs) + ) return result diff --git a/synapse/storage/push_rule.py b/synapse/storage/push_rule.py index a6517c4cf3..1f878e6575 100644 --- a/synapse/storage/push_rule.py +++ b/synapse/storage/push_rule.py @@ -235,7 +235,7 @@ class PushRulesWorkerStore( (c.get("key") == "room_id" and c.get("pattern") == old_room_id) for c in conditions ): - self.move_push_rule_from_room_to_room(new_room_id, user_id, rule) + yield self.move_push_rule_from_room_to_room(new_room_id, user_id, rule) @defer.inlineCallbacks def bulk_get_push_rules_for_room(self, event, context): |