diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-08 16:46:56 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-08 16:46:56 +0100 |
commit | a43b40449b5257cec4e2e740c2f90728be84b695 (patch) | |
tree | 805220033f1fcc25dbf88e0356ee3f90ec7a3970 /synapse | |
parent | Merge branch 'develop' of github.com:matrix-org/synapse into mysql (diff) | |
parent | Merge branch 'master' of github.com:matrix-org/synapse into develop (diff) | |
download | synapse-a43b40449b5257cec4e2e740c2f90728be84b695.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into mysql
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/__init__.py | 2 | ||||
-rw-r--r-- | synapse/handlers/federation.py | 40 | ||||
-rw-r--r-- | synapse/util/expiringcache.py | 2 |
3 files changed, 38 insertions, 6 deletions
diff --git a/synapse/__init__.py b/synapse/__init__.py index 749a60329c..fd87c7e2d0 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -16,4 +16,4 @@ """ This is a reference implementation of a Matrix home server. """ -__version__ = "0.8.1-r2" +__version__ = "0.8.1-r3" diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 9a4773ac02..98148c13d7 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -201,10 +201,18 @@ class FederationHandler(BaseHandler): target_user = UserID.from_string(target_user_id) extra_users.append(target_user) - yield self.notifier.on_new_room_event( + d = self.notifier.on_new_room_event( event, extra_users=extra_users ) + def log_failure(f): + logger.warn( + "Failed to notify about %s: %s", + event.event_id, f.value + ) + + d.addErrback(log_failure) + if event.type == EventTypes.Member: if event.membership == Membership.JOIN: user = UserID.from_string(event.state_key) @@ -427,10 +435,18 @@ class FederationHandler(BaseHandler): auth_events=auth_events, ) - yield self.notifier.on_new_room_event( + d = self.notifier.on_new_room_event( new_event, extra_users=[joinee] ) + def log_failure(f): + logger.warn( + "Failed to notify about %s: %s", + new_event.event_id, f.value + ) + + d.addErrback(log_failure) + logger.debug("Finished joining %s to %s", joinee, room_id) finally: room_queue = self.room_queues[room_id] @@ -500,10 +516,18 @@ class FederationHandler(BaseHandler): target_user = UserID.from_string(target_user_id) extra_users.append(target_user) - yield self.notifier.on_new_room_event( + d = self.notifier.on_new_room_event( event, extra_users=extra_users ) + def log_failure(f): + logger.warn( + "Failed to notify about %s: %s", + event.event_id, f.value + ) + + d.addErrback(log_failure) + if event.type == EventTypes.Member: if event.content["membership"] == Membership.JOIN: user = UserID.from_string(event.state_key) @@ -574,10 +598,18 @@ class FederationHandler(BaseHandler): ) target_user = UserID.from_string(event.state_key) - yield self.notifier.on_new_room_event( + d = self.notifier.on_new_room_event( event, extra_users=[target_user], ) + def log_failure(f): + logger.warn( + "Failed to notify about %s: %s", + event.event_id, f.value + ) + + d.addErrback(log_failure) + defer.returnValue(event) @defer.inlineCallbacks diff --git a/synapse/util/expiringcache.py b/synapse/util/expiringcache.py index 1c7859297a..06d1eea01b 100644 --- a/synapse/util/expiringcache.py +++ b/synapse/util/expiringcache.py @@ -65,7 +65,7 @@ class ExpiringCache(object): if self._max_len and len(self._cache.keys()) > self._max_len: sorted_entries = sorted( self._cache.items(), - key=lambda k, v: v.time, + key=lambda (k, v): v.time, ) for k, _ in sorted_entries[self._max_len:]: |