summary refs log tree commit diff
path: root/scripts-dev/tail-synapse.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-10-20 11:16:55 +1100
committerGitHub <noreply@github.com>2018-10-20 11:16:55 +1100
commite1728dfcbe585edfb590bce50adeaab341a70db8 (patch)
tree0ae215c46f15ecc917bf45d75430298a003b0e27 /scripts-dev/tail-synapse.py
parentMerge branch 'rav/fix_email_templates_4065' into develop (diff)
downloadsynapse-e1728dfcbe585edfb590bce50adeaab341a70db8.tar.xz
Make scripts/ and scripts-dev/ pass pyflakes (and the rest of the codebase on py3) (#4068)
Diffstat (limited to 'scripts-dev/tail-synapse.py')
-rw-r--r--scripts-dev/tail-synapse.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/scripts-dev/tail-synapse.py b/scripts-dev/tail-synapse.py
index 18be711e92..1a36b94038 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,7 +46,7 @@ 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:
             time.sleep(0.1)
@@ -53,8 +54,8 @@ def main():
     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()