diff options
author | Erik Johnston <erik@matrix.org> | 2016-02-04 10:22:44 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-02-08 14:26:45 +0000 |
commit | 2c1fbea5319db2c64fa486adb32b5e66680b6daf (patch) | |
tree | f34fb636206664ffa531e30d703469ff1a6d3a19 /synapse/util/async.py | |
parent | Add metrics to pushers (diff) | |
download | synapse-2c1fbea5319db2c64fa486adb32b5e66680b6daf.tar.xz |
Fix up logcontexts
Diffstat (limited to 'synapse/util/async.py')
-rw-r--r-- | synapse/util/async.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/util/async.py b/synapse/util/async.py index 200edd404c..640fae3890 100644 --- a/synapse/util/async.py +++ b/synapse/util/async.py @@ -16,13 +16,16 @@ from twisted.internet import defer, reactor -from .logcontext import preserve_context_over_deferred +from .logcontext import PreserveLoggingContext +@defer.inlineCallbacks def sleep(seconds): d = defer.Deferred() - reactor.callLater(seconds, d.callback, seconds) - return preserve_context_over_deferred(d) + with PreserveLoggingContext(): + reactor.callLater(seconds, d.callback, seconds) + res = yield d + defer.returnValue(res) def run_on_reactor(): @@ -54,6 +57,7 @@ class ObservableDeferred(object): object.__setattr__(self, "_result", (True, r)) while self._observers: try: + # TODO: Handle errors here. self._observers.pop().callback(r) except: pass @@ -63,6 +67,7 @@ class ObservableDeferred(object): object.__setattr__(self, "_result", (False, f)) while self._observers: try: + # TODO: Handle errors here. self._observers.pop().errback(f) except: pass |