diff options
author | Ben Sima <ben@bsima.me> | 2020-04-11 00:57:22 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-04-11 00:57:22 -0700 |
commit | 876d0b1abc63754daba58c60c1ecdc2b4802d3bc (patch) | |
tree | b73949a656c8566a5e048f1a99d4a556d0b558f9 /Run/Que/client.py | |
parent | a482720e19b5d98c7c2ad637d9158e75fa0c2bd9 (diff) |
Retry after disconnect
I think this will only retry once... would be nice to have some kind of
backoff... oh well.
Diffstat (limited to 'Run/Que/client.py')
-rwxr-xr-x | Run/Que/client.py | 10 |
1 files changed, 9 insertions, 1 deletions
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) |