From 69dfd049e4fb22d463217b65daecdf71d4af90e9 Mon Sep 17 00:00:00 2001 From: Shlomi Kushchi Date: Fri, 5 Feb 2021 09:30:12 +0200 Subject: [PATCH] make sure the loop never breaks --- main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index d07fac5..f826fc1 100644 --- a/main.py +++ b/main.py @@ -187,11 +187,14 @@ async def send_response_to_client(): :return: """ while 1: - if response_queue.empty(): - await asyncio.sleep(0.05) - continue - response = response_queue.get() - await response["subscriber"].send(json.dumps(response["response"])) + try: + if response_queue.empty(): + await asyncio.sleep(0.05) + continue + response = response_queue.get() + await response["subscriber"].send(json.dumps(response["response"])) + except: + pass if __name__ == '__main__':