mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
fix: when websockets are disconnected, the exception is now WebsocketClosed
This commit is contained in:
parent
9c248a85f0
commit
e2b9a88ef4
1 changed files with 2 additions and 2 deletions
4
run.py
4
run.py
|
@ -29,7 +29,7 @@ from websockets.exceptions import ConnectionClosed
|
||||||
from websockets import WebSocketCommonProtocol
|
from websockets import WebSocketCommonProtocol
|
||||||
|
|
||||||
from sanic import Sanic, response
|
from sanic import Sanic, response
|
||||||
from sanic.exceptions import NotFound
|
from sanic.exceptions import NotFound, WebsocketClosed
|
||||||
from sanic.log import LOGGING_CONFIG_DEFAULTS
|
from sanic.log import LOGGING_CONFIG_DEFAULTS
|
||||||
|
|
||||||
from jinja2 import FileSystemLoader
|
from jinja2 import FileSystemLoader
|
||||||
|
@ -525,7 +525,7 @@ async def broadcast(message, channels):
|
||||||
for ws in ws_list:
|
for ws in ws_list:
|
||||||
try:
|
try:
|
||||||
await ws.send(my_json_dumps(message))
|
await ws.send(my_json_dumps(message))
|
||||||
except ConnectionClosed:
|
except (ConnectionClosed, WebsocketClosed):
|
||||||
dead_ws.append(ws)
|
dead_ws.append(ws)
|
||||||
|
|
||||||
for to_remove in dead_ws:
|
for to_remove in dead_ws:
|
||||||
|
|
Loading…
Add table
Reference in a new issue