From: Zachary Vance Date: Thu, 19 Aug 2021 19:04:14 +0000 (-0700) Subject: Run forever X-Git-Url: https://git.za3k.com/?a=commitdiff_plain;h=b09f7d21c1614dde06083f0b686c3070aaea9840;p=mqlg.git Run forever --- 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()