@@ -1077,11 +1077,10 @@ async def _serve(
10771077 reset_session_close_countdown ()
10781078 our_task = asyncio .current_task ()
10791079 idx = 0
1080- while our_task and not our_task .cancelling () and not our_task .cancelled ():
1081- logging .debug (f"_serve loop count={ idx } " )
1082- idx += 1
1083- try :
1084- logging .debug ("_handle_messages_from_ws started" )
1080+ try :
1081+ while our_task and not our_task .cancelling () and not our_task .cancelled ():
1082+ logging .debug (f"_serve loop count={ idx } " )
1083+ idx += 1
10851084 while (ws := get_ws ()) is None or get_state () == SessionState .CONNECTING :
10861085 logging .debug ("_handle_messages_from_ws spinning while connecting" )
10871086 await asyncio .sleep (1 )
@@ -1190,16 +1189,16 @@ async def _serve(
11901189 logger .exception ("caught exception at message iterator" )
11911190 break
11921191 logging .debug ("_handle_messages_from_ws exiting" )
1193- except ExceptionGroup as eg :
1194- _ , unhandled = eg .split (lambda e : isinstance (e , ConnectionClosed ))
1195- if unhandled :
1196- # We're in a task, there's not that much that can be done.
1197- unhandled = ExceptionGroup (
1198- "Unhandled exceptions on River server" , unhandled .exceptions
1199- )
1200- logger .exception (
1201- "caught exception at message iterator" ,
1202- exc_info = unhandled ,
1203- )
1204- raise unhandled
1192+ except ExceptionGroup as eg :
1193+ _ , unhandled = eg .split (lambda e : isinstance (e , ConnectionClosed ))
1194+ if unhandled :
1195+ # We're in a task, there's not that much that can be done.
1196+ unhandled = ExceptionGroup (
1197+ "Unhandled exceptions on River server" , unhandled .exceptions
1198+ )
1199+ logger .exception (
1200+ "caught exception at message iterator" ,
1201+ exc_info = unhandled ,
1202+ )
1203+ raise unhandled
12051204 logging .debug (f"_serve exiting normally after { idx } loops" )
0 commit comments