diff options
author | Erik Johnston <erik@matrix.org> | 2016-03-18 15:23:20 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-03-18 15:23:20 +0000 |
commit | e4054abfdca787f5ee9f1a1f1ed52940991767a7 (patch) | |
tree | 0ce5516f826f9d0066ae64b4cf74abfa8b57a7e1 | |
parent | Merge pull request #656 from matrix-org/erikj/get_event (diff) | |
parent | Catch exceptions from EDU handling (diff) | |
download | synapse-e4054abfdca787f5ee9f1a1f1ed52940991767a7.tar.xz |
Merge pull request #655 from matrix-org/erikj/edu_yield
Yield on EDU handling
-rw-r--r-- | synapse/federation/federation_server.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py index e8bfbe7cb5..76820b924b 100644 --- a/synapse/federation/federation_server.py +++ b/synapse/federation/federation_server.py @@ -137,8 +137,8 @@ class FederationServer(FederationBase): logger.exception("Failed to handle PDU") if hasattr(transaction, "edus"): - for edu in [Edu(**x) for x in transaction.edus]: - self.received_edu( + for edu in (Edu(**x) for x in transaction.edus): + yield self.received_edu( transaction.origin, edu.edu_type, edu.content @@ -161,11 +161,17 @@ class FederationServer(FederationBase): ) defer.returnValue((200, response)) + @defer.inlineCallbacks def received_edu(self, origin, edu_type, content): received_edus_counter.inc() if edu_type in self.edu_handlers: - self.edu_handlers[edu_type](origin, content) + try: + yield self.edu_handlers[edu_type](origin, content) + except SynapseError as e: + logger.info("Failed to handle edu %r: %r", edu_type, e) + except Exception as e: + logger.exception("Failed to handle edu %r", edu_type, e) else: logger.warn("Received EDU of type %s with no handler", edu_type) |