File tree Expand file tree Collapse file tree 1 file changed +21
-14
lines changed Expand file tree Collapse file tree 1 file changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -1458,22 +1458,29 @@ async def _check_connection_health(self) -> bool:
14581458 if not self .is_connected :
14591459 if self .options [
14601460 "allow_reconnect"
1461- ] and not self .is_reconnecting and not self .is_closed :
1462- self ._status = Client .RECONNECTING
1463- self ._ps .reset ()
1464-
1465- try :
1466- if self ._reconnection_task is not None and not self ._reconnection_task .cancelled (
1467- ):
1468- self ._reconnection_task .cancel ()
1469-
1470- loop = asyncio .get_running_loop ()
1471- self ._reconnection_task = loop .create_task (self ._attempt_reconnect ())
1472-
1461+ ]:
1462+ if self .is_reconnecting :
14731463 await asyncio .sleep (self .options ["reconnect_time_wait" ])
14741464 return self .is_connected
1475- except Exception :
1476- return False
1465+
1466+ if not self .is_closed :
1467+ self ._status = Client .RECONNECTING
1468+ self ._ps .reset ()
1469+
1470+ try :
1471+ if self ._reconnection_task is not None and not self ._reconnection_task .cancelled (
1472+ ):
1473+ self ._reconnection_task .cancel ()
1474+
1475+ loop = asyncio .get_running_loop ()
1476+ self ._reconnection_task = loop .create_task (self ._attempt_reconnect ())
1477+
1478+ await asyncio .sleep (self .options ["reconnect_time_wait" ])
1479+ return self .is_connected
1480+ except Exception :
1481+ return False
1482+
1483+ return False
14771484 return False
14781485 return True
14791486
You can’t perform that action at this time.
0 commit comments