From 46f9b0ec08ea91804460e9ffc6d02b222cb7a475 Mon Sep 17 00:00:00 2001 From: n9k Date: Sun, 19 Jun 2022 09:24:28 +0000 Subject: [PATCH] Reset websocket aliveness timer on first connecting This should eliminate the possibilty of the websocket-closing background task closing a newly opened websocket that hasn't yet ponged our ping (if we have even sent a ping yet). --- anonstream/routes/websocket.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/anonstream/routes/websocket.py b/anonstream/routes/websocket.py index f342b0d..96dbb84 100644 --- a/anonstream/routes/websocket.py +++ b/anonstream/routes/websocket.py @@ -2,9 +2,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later import asyncio - -from math import inf - from quart import current_app, websocket from anonstream.user import see, reading @@ -15,7 +12,7 @@ from anonstream.routes.wrappers import with_user_from @with_user_from(websocket) async def live(timestamp, user): queue = asyncio.Queue() - user['websockets'][queue] = -inf + user['websockets'][queue] = timestamp reading(user, timestamp=timestamp) producer = websocket_outbound(queue, user)