File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -677,7 +677,7 @@ async def _drain_sse_events(
677677 except StopAsyncIteration :
678678 break
679679 except asyncio .TimeoutError :
680- LOG .warning (
680+ LOG .info (
681681 "SSE keepalive timeout (%ss without data), reconnecting..." ,
682682 self ._SSE_KEEPALIVE_TIMEOUT ,
683683 )
@@ -743,6 +743,28 @@ async def _listen_to_sse(
743743 )
744744 await asyncio .sleep (5 )
745745
746+ except asyncio .TimeoutError :
747+ # Keepalive timeout: the connection was recently live, so start
748+ # the next reconnect cycle with the base delay (not accumulated).
749+ backoff_delay = self ._BACKOFF_BASE
750+ LOG .debug (
751+ "Reconnecting after keepalive timeout in %s seconds..." ,
752+ backoff_delay ,
753+ )
754+ await asyncio .sleep (backoff_delay )
755+ backoff_delay = min (backoff_delay * 2 , self ._BACKOFF_MAX )
756+ if "query" in payload :
757+ del payload ["query" ]
758+ if location_hilo_id :
759+ try :
760+ await self .call_get_location_query (location_hilo_id )
761+ LOG .debug ("call_get_location_query success after reconnect" )
762+ except Exception as e2 :
763+ LOG .error (
764+ "exception while RE-connecting, retrying: %s" ,
765+ e2 ,
766+ )
767+
746768 except Exception as e :
747769 LOG .debug (
748770 "Subscription connection lost: %s. Reconnecting in %s seconds..." ,
You can’t perform that action at this time.
0 commit comments