summary refs log tree commit diff
path: root/synapse/util/async_helpers.py
diff options
context:
space:
mode:
authorJonathan de Jong <jonathan@automatia.nl>2021-03-09 12:09:31 +0100
committerGitHub <noreply@github.com>2021-03-09 11:09:31 +0000
commit9898470e7d7b1b2f3c0dfa7d07832ec4662221da (patch)
tree93f54482fd57bc2220967b6125bc7c9460e8d4eb /synapse/util/async_helpers.py
parentquick config comment tweak to clarify allow_profile_lookup_over_federation (diff)
downloadsynapse-9898470e7d7b1b2f3c0dfa7d07832ec4662221da.tar.xz
Add logging to ObservableDeferred callbacks (#9523)
Diffstat (limited to '')
-rw-r--r--synapse/util/async_helpers.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/synapse/util/async_helpers.py b/synapse/util/async_helpers.py
index 719e35b78d..f33c115844 100644
--- a/synapse/util/async_helpers.py
+++ b/synapse/util/async_helpers.py
@@ -76,11 +76,16 @@ class ObservableDeferred:
         def callback(r):
             object.__setattr__(self, "_result", (True, r))
             while self._observers:
+                observer = self._observers.pop()
                 try:
-                    # TODO: Handle errors here.
-                    self._observers.pop().callback(r)
-                except Exception:
-                    pass
+                    observer.callback(r)
+                except Exception as e:
+                    logger.exception(
+                        "%r threw an exception on .callback(%r), ignoring...",
+                        observer,
+                        r,
+                        exc_info=e,
+                    )
             return r
 
         def errback(f):
@@ -90,11 +95,16 @@ class ObservableDeferred:
                 # traces when we `await` on one of the observer deferreds.
                 f.value.__failure__ = f
 
+                observer = self._observers.pop()
                 try:
-                    # TODO: Handle errors here.
-                    self._observers.pop().errback(f)
-                except Exception:
-                    pass
+                    observer.errback(f)
+                except Exception as e:
+                    logger.exception(
+                        "%r threw an exception on .errback(%r), ignoring...",
+                        observer,
+                        f,
+                        exc_info=e,
+                    )
 
             if consumeErrors:
                 return None