From 876d0b1abc63754daba58c60c1ecdc2b4802d3bc Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 11 Apr 2020 00:57:22 -0700 Subject: Retry after disconnect I think this will only retry once... would be nice to have some kind of backoff... oh well. --- Run/Que/client.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Run') diff --git a/Run/Que/client.py b/Run/Que/client.py index e272d6a..cd24618 100755 --- a/Run/Que/client.py +++ b/Run/Que/client.py @@ -5,6 +5,7 @@ simple client for que.run import argparse import configparser +import http.client import os import subprocess import sys @@ -110,8 +111,8 @@ def get_args(): if __name__ == "__main__": + args = get_args() try: - args = get_args() if args.infile: send(args) else: @@ -121,3 +122,10 @@ if __name__ == "__main__": except urllib.error.HTTPError as e: print(e) sys.exit(1) + except http.client.RemoteDisconnected as e: + print("disconnected... retrying in 5 seconds") + time.sleep(5) + if args.infile: + send(args) + else: + recv(args) -- cgit v1.2.3