File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 6767
6868HB_PING_TIME = 10
6969HB_PONG_TIME = 10
70+ POLL_TIME_BLOCKING = 5.0
71+ POLL_TIME_NON_BLOCKING = 0.01
7072TIMEOUT_TIME = 30.0
7173RETRY_TIME = 5.0
7274
@@ -538,7 +540,7 @@ def run(self) -> None:
538540 self .logger .debug ("Thread started..." )
539541 while not self .stop .is_set ():
540542 try :
541- if self ._run_once () == 1 :
543+ if self ._run_once (timeout = POLL_TIME_BLOCKING ) == 1 :
542544 break
543545 except Exception : # pylint: disable=broad-except
544546 self ._force_recon = True
@@ -553,7 +555,7 @@ def run(self) -> None:
553555 # Clean up
554556 self ._cleanup ()
555557
556- def _run_once (self ) -> int :
558+ def _run_once (self , timeout : float = POLL_TIME_NON_BLOCKING ) -> int :
557559 """Receive from the socket and handle data."""
558560 # pylint: disable=too-many-branches, too-many-statements, too-many-return-statements
559561
@@ -568,7 +570,7 @@ def _run_once(self) -> int:
568570
569571 # poll the socket, as well as the socketpair to allow us to be interrupted
570572 try :
571- ready = self .selector .select ()
573+ ready = self .selector .select (timeout )
572574 except (ValueError , OSError ) as exc :
573575 self .logger .error (
574576 "[%s(%s):%s] Error in select call: %s" ,
You can’t perform that action at this time.
0 commit comments