Skip to content

Commit

Permalink
make sure the loop never breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomiku committed Feb 5, 2021
1 parent d652a4d commit 69dfd04
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down

0 comments on commit 69dfd04

Please sign in to comment.