summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-08-05 18:02:03 +0100
committerErik Johnston <erik@matrix.org>2016-08-05 18:02:03 +0100
commit46453bfc2f203bae8ac7845f04ef64c04e172c92 (patch)
treea272ca147dad387246c696e51421b100aef95e89 /synapse
parentPrint newline after result in federation_client script (diff)
downloadsynapse-46453bfc2f203bae8ac7845f04ef64c04e172c92.tar.xz
Retry joining via other servers if first one failed
Diffstat (limited to 'synapse')
-rw-r--r--synapse/federation/federation_client.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py
index 65778fd4ee..92332cfdcf 100644
--- a/synapse/federation/federation_client.py
+++ b/synapse/federation/federation_client.py
@@ -523,14 +523,19 @@ class FederationClient(FederationBase):
                     (destination, self.event_from_pdu_json(pdu_dict))
                 )
                 break
-            except CodeMessageException:
-                raise
+            except CodeMessageException as e:
+                if not 500 <= e.code < 600:
+                    raise
+                else:
+                    logger.warn(
+                        "Failed to make_%s via %s: %s",
+                        membership, destination, e.message
+                    )
             except Exception as e:
                 logger.warn(
                     "Failed to make_%s via %s: %s",
                     membership, destination, e.message
                 )
-                raise
 
         raise RuntimeError("Failed to send to any server.")
 
@@ -602,8 +607,14 @@ class FederationClient(FederationBase):
                     "auth_chain": signed_auth,
                     "origin": destination,
                 })
-            except CodeMessageException:
-                raise
+            except CodeMessageException as e:
+                if not 500 <= e.code < 600:
+                    raise
+                else:
+                    logger.exception(
+                        "Failed to send_join via %s: %s",
+                        destination, e.message
+                    )
             except Exception as e:
                 logger.exception(
                     "Failed to send_join via %s: %s",