Catch error when task is stopped (#306)

This commit is contained in:
Jesse Hills 2022-11-15 20:26:11 +13:00 committed by GitHub
parent 949563c6f0
commit 356e4fbd8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -531,7 +531,10 @@ class APIConnection:
# Socket closed but task isn't cancelled yet # Socket closed but task isn't cancelled yet
break break
msg = await self._to_process.get() try:
msg = await self._to_process.get()
except RuntimeError:
break
for handler in self._message_handlers[:]: for handler in self._message_handlers[:]:
handler(msg) handler(msg)