summary refs log tree commit diff
path: root/scripts-dev/tail-synapse.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-11-03 01:12:37 +1100
committerGitHub <noreply@github.com>2018-11-03 01:12:37 +1100
commitea708efedd7f207ce3fc05835612391816f8d4a1 (patch)
tree42bdd87aaffc48f6d92c7e6b4d748e2c8cb821fe /scripts-dev/tail-synapse.py
parentchangelog (diff)
parentFix typing being reset causing infinite syncs (#4127) (diff)
downloadsynapse-ea708efedd7f207ce3fc05835612391816f8d4a1.tar.xz
Merge branch 'develop' into matthew/heroes-for-avatars github/matthew/heroes-for-avatars matthew/heroes-for-avatars
Diffstat (limited to 'scripts-dev/tail-synapse.py')
-rw-r--r--scripts-dev/tail-synapse.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts-dev/tail-synapse.py b/scripts-dev/tail-synapse.py
index 18be711e92..7c9985d9f0 100644
--- a/scripts-dev/tail-synapse.py
+++ b/scripts-dev/tail-synapse.py
@@ -1,8 +1,9 @@
-import requests
 import collections
+import json
 import sys
 import time
-import json
+
+import requests
 
 Entry = collections.namedtuple("Entry", "name position rows")
 
@@ -30,11 +31,11 @@ def parse_response(content):
 
 
 def replicate(server, streams):
-    return parse_response(requests.get(
-        server + "/_synapse/replication",
-        verify=False,
-        params=streams
-    ).content)
+    return parse_response(
+        requests.get(
+            server + "/_synapse/replication", verify=False, params=streams
+        ).content
+    )
 
 
 def main():
@@ -45,16 +46,16 @@ def main():
         try:
             streams = {
                 row.name: row.position
-                for row in replicate(server, {"streams":"-1"})["streams"].rows
+                for row in replicate(server, {"streams": "-1"})["streams"].rows
             }
-        except requests.exceptions.ConnectionError as e:
+        except requests.exceptions.ConnectionError:
             time.sleep(0.1)
 
     while True:
         try:
             results = replicate(server, streams)
-        except:
-            sys.stdout.write("connection_lost("+ repr(streams) + ")\n")
+        except Exception:
+            sys.stdout.write("connection_lost(" + repr(streams) + ")\n")
             break
         for update in results.values():
             for row in update.rows:
@@ -62,6 +63,5 @@ def main():
             streams[update.name] = update.position
 
 
-
-if __name__=='__main__':
+if __name__ == '__main__':
     main()