diff options
author | Erik Johnston <erik@matrix.org> | 2015-02-17 13:08:27 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-02-17 13:13:14 +0000 |
commit | 02bfa889de1990eb8dc47770834bef777252dc82 (patch) | |
tree | 5a6c431ff7cb2d3698450de5a47ccbac4efa4369 /synapse/federation/federation_server.py | |
parent | We do want to consumeError (diff) | |
download | synapse-02bfa889de1990eb8dc47770834bef777252dc82.tar.xz |
Handle recieving failures in transactions
Diffstat (limited to '')
-rw-r--r-- | synapse/federation/federation_server.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py index e94d0411b4..34f5b17446 100644 --- a/synapse/federation/federation_server.py +++ b/synapse/federation/federation_server.py @@ -114,7 +114,15 @@ class FederationServer(FederationBase): with PreserveLoggingContext(): dl = [] for pdu in pdu_list: - dl.append(self._handle_new_pdu(transaction.origin, pdu)) + d = self._handle_new_pdu(transaction.origin, pdu) + + def handle_failure(failure): + failure.trap(FederationError) + self.enqueue_failure(failure.value, transaction.origin) + + d.addErrback(handle_failure) + + dl.append(d) if hasattr(transaction, "edus"): for edu in [Edu(**x) for x in transaction.edus]: @@ -124,6 +132,9 @@ class FederationServer(FederationBase): edu.content ) + for failure in getattr(transaction, "failures", []): + logger.info("Got failure %r", failure) + results = yield defer.DeferredList(dl, consumeErrors=True) ret = [] |