summary refs log tree commit diff
path: root/synapse/handlers/federation.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-06 10:53:18 +0000
committerErik Johnston <erik@matrix.org>2015-02-06 10:53:18 +0000
commit3737329d9b40b54bc4205c5f5e7e0946c5e51614 (patch)
tree058327fd853a0f81b6dfbf66de126752710a229a /synapse/handlers/federation.py
parentpriority class now dealt with in namespaced rule_id (diff)
downloadsynapse-3737329d9b40b54bc4205c5f5e7e0946c5e51614.tar.xz
Handle the fact the list.remove raises if element doesn't exist
Diffstat (limited to '')
-rw-r--r--synapse/handlers/federation.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index aba266c2bc..9d0ce9aa50 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -332,8 +332,11 @@ class FederationHandler(BaseHandler):
 
             # Try the host we successfully got a response to /make_join/
             # request first.
-            target_hosts.remove(origin)
-            target_hosts.insert(0, origin)
+            try:
+                target_hosts.remove(origin)
+                target_hosts.insert(0, origin)
+            except ValueError:
+                pass
 
             ret = yield self.replication_layer.send_join(
                 target_hosts,
@@ -521,7 +524,7 @@ class FederationHandler(BaseHandler):
                     "Failed to get destination from event %s", s.event_id
                 )
 
-        destinations.remove(origin)
+        destinations.discard(origin)
 
         logger.debug(
             "on_send_join_request: Sending event: %s, signatures: %s",
@@ -1013,7 +1016,10 @@ class FederationHandler(BaseHandler):
         for e in missing_remotes:
             for e_id, _ in e.auth_events:
                 if e_id in missing_remote_ids:
-                    base_remote_rejected.remove(e)
+                    try:
+                        base_remote_rejected.remove(e)
+                    except ValueError:
+                        pass
 
         reason_map = {}