[mod] actually websocket has a real method for that, maybe that will prevent leaks?

This commit is contained in:
Laurent Peuch 2019-04-01 18:13:33 +02:00
parent 1b3247df97
commit 102dec555f

32
run.py
View file

@ -515,13 +515,7 @@ async def ws_index(request, websocket):
map(model_to_dict, latest_done_jobs)), map(model_to_dict, latest_done_jobs)),
})) }))
while True: await websocket.wait_closed()
# ping periodically to remove dead connections
try:
await websocket.send("ping")
except ConnectionClosed:
return
await asyncio.sleep(60)
@app.websocket('/job-<job_id>-ws') @app.websocket('/job-<job_id>-ws')
@ -540,13 +534,7 @@ async def ws_job(request, websocket, job_id):
"data": model_to_dict(job), "data": model_to_dict(job),
})) }))
while True: await websocket.wait_closed()
# ping periodically to remove dead connections
try:
await websocket.send("ping")
except ConnectionClosed:
return
await asyncio.sleep(60)
@app.websocket('/apps-ws') @app.websocket('/apps-ws')
@ -642,13 +630,7 @@ async def ws_apps(request, websocket):
"data": repos, "data": repos,
})) }))
while True: await websocket.wait_closed()
# ping periodically to remove dead connections
try:
await websocket.send("ping")
except ConnectionClosed:
return
await asyncio.sleep(60)
@app.websocket('/app-<app_name>-ws') @app.websocket('/app-<app_name>-ws')
@ -665,13 +647,7 @@ async def ws_app(request, websocket, app_name):
app.url).order_by(-Job.id), app.url).order_by(-Job.id),
})) }))
while True: await websocket.wait_closed()
# ping periodically to remove dead connections
try:
await websocket.send("ping")
except ConnectionClosed:
return
await asyncio.sleep(60)
def require_token(): def require_token():