dashboard_client: avoid a potential bug with task_done() not being called if send_object raises an exception

master
Ivan Kozik 2018-10-07 21:43:42 +00:00
parent f24959ce4a
commit ca6e77e378
1 changed files with 4 additions and 2 deletions

View File

@ -44,8 +44,10 @@ async def sender(plugin, uri):
})
while True:
obj = await plugin.ws_queue.get()
await send_object(ws, obj)
plugin.ws_queue.task_done()
try:
await send_object(ws, obj)
finally:
plugin.ws_queue.task_done()
except Exception as e:
delay = decayer.decay()
print(f"Disconnected from ws:// server: {repr(e)}")