]> git.za3k.com Git - mqlg.git/commitdiff
Run forever
authorZachary Vance <za3k@za3k.com>
Thu, 19 Aug 2021 19:04:14 +0000 (12:04 -0700)
committerZachary Vance <za3k@za3k.com>
Thu, 19 Aug 2021 19:04:14 +0000 (12:04 -0700)
main.py

diff --git a/main.py b/main.py
index 6f00554e394d39b6b54f8be997f653c81c745d36..3b76d953006b39fc106b433ccf282feb5635b594 100755 (executable)
--- 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()