diff --git a/reHDDPrinter.py b/reHDDPrinter.py index 899c0e6..a19780d 100644 --- a/reHDDPrinter.py +++ b/reHDDPrinter.py @@ -201,15 +201,15 @@ def main(): print("Running in test mode.") worker(None, test_mode=True) return - - try: - queue_id = msgget(MSG_QUEUE_KEY, 0) - if queue_id == -1: - raise RuntimeError("Failed to connect to the existing message queue.") - - worker(queue_id) - except Exception as e: - print(f"Main process encountered an error: {e}") + while True: + try: + queue_id = msgget(MSG_QUEUE_KEY, 0) + if queue_id == -1: + raise RuntimeError("Failed to connect to the existing message queue.") + worker(queue_id) + except Exception as e: + print(f"Main process encountered an error: {e}") + time.sleep(30) if __name__ == "__main__":