@@ -1221,8 +1221,8 @@ async def _recv_from_ws(
12211221 """
12221222 our_task = asyncio .current_task ()
12231223 connection_attempts = 0
1224- try :
1225- while our_task and not our_task . cancelling () and not our_task . cancelled () :
1224+ while our_task and not our_task . cancelling () and not our_task . cancelled () :
1225+ try :
12261226 logger .debug (f"_recv_from_ws loop count={ connection_attempts } " )
12271227 connection_attempts += 1
12281228 ws = None
@@ -1359,21 +1359,22 @@ async def _recv_from_ws(
13591359 logger .debug (
13601360 "FailedSendingMessageException while serving" , exc_info = True
13611361 )
1362- break
1362+ break # Inner loop
13631363 except Exception :
13641364 logger .exception ("caught exception at message iterator" )
1365- break
1365+ await transition_no_connection ()
1366+ break # Inner loop
13661367 logger .debug ("_handle_messages_from_ws exiting" )
1367- except ExceptionGroup as eg :
1368- _ , unhandled = eg .split (lambda e : isinstance (e , ConnectionClosed ))
1369- if unhandled :
1370- # We're in a task, there's not that much that can be done.
1371- unhandled = ExceptionGroup (
1372- "Unhandled exceptions on River server" , unhandled .exceptions
1373- )
1374- logger .exception (
1375- "caught exception at message iterator" ,
1376- exc_info = unhandled ,
1377- )
1378- raise unhandled
1368+ except ExceptionGroup as eg :
1369+ _ , unhandled = eg .split (lambda e : isinstance (e , ConnectionClosed ))
1370+ if unhandled :
1371+ # We're in a task, there's not that much that can be done.
1372+ unhandled = ExceptionGroup (
1373+ "Unhandled exceptions on River server" , unhandled .exceptions
1374+ )
1375+ logger .exception (
1376+ "caught exception at message iterator" ,
1377+ exc_info = unhandled ,
1378+ )
1379+ raise unhandled
13791380 logger .debug (f"_recv_from_ws exiting normally after { connection_attempts } loops" )
0 commit comments