From b09f7d21c1614dde06083f0b686c3070aaea9840 Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Thu, 19 Aug 2021 12:04:14 -0700 Subject: [PATCH] Run forever --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 6f00554..3b76d95 100755 --- a/main.py +++ b/main.py @@ -78,6 +78,7 @@ def threaded_consumer(queue, response_queue, consumer_callback, threads=None): except KeyboardInterrupt: executor.shutdown() channel.stop_consuming() + raise def remove_file(path): try: @@ -179,7 +180,12 @@ if __name__ == '__main__': if len(args) != 0: raise InvalidArguments() logging.getLogger().addHandler(printed) - threaded_consumer(module.QUEUE, module.QUEUE_RESP, functools.partial(do_work, module.extract_text), threads=threads) + while True: + try: + threaded_consumer(module.QUEUE, module.QUEUE_RESP, functools.partial(do_work, module.extract_text), threads=threads) + except KeyboardInterrupt: + time.sleep(60) + break elif command == "listener": if len(args) != 0: raise InvalidArguments() -- 2.47.3