diff options
author | Erik Johnston <erik@matrix.org> | 2016-02-08 15:16:16 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-02-08 15:16:16 +0000 |
commit | 2bb5f035affda14742ab715033570616621c0000 (patch) | |
tree | 9348a7051ebb1d264afa47b2ce2d87c8b19f5523 /synapse/util/async.py | |
parent | Merge pull request #562 from matrix-org/erikj/push_metric (diff) | |
parent | Fix up logcontexts (diff) | |
download | synapse-2bb5f035affda14742ab715033570616621c0000.tar.xz |
Merge pull request #564 from matrix-org/erikj/logcontext
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 |