File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 66import logging
77import os
88import random
9+ import threading
10+ import time
911from concurrent .futures import ThreadPoolExecutor
1012from datetime import datetime , timedelta
1113from threading import Event , Thread
@@ -237,10 +239,8 @@ def __init__(
237239 self ._channel_options = channel_options
238240 self ._stop_timeout = stop_timeout
239241 # Track in-flight activity executions for graceful draining
240- import threading as _threading
241-
242242 self ._active_task_count = 0
243- self ._active_task_cv = _threading .Condition ()
243+ self ._active_task_cv = threading .Condition ()
244244
245245 # Use provided concurrency options or create default ones
246246 self ._concurrency_options = (
@@ -532,16 +532,13 @@ def wait_for_idle(self, timeout: Optional[float] = None) -> bool:
532532 """
533533 end : Optional [float ] = None
534534 if timeout is not None :
535- import time as _t
536535
537- end = _t .time () + timeout
536+ end = time .time () + timeout
538537 with self ._active_task_cv :
539538 while self ._active_task_count > 0 :
540539 remaining = None
541540 if end is not None :
542- import time as _t
543-
544- remaining = max (0.0 , end - _t .time ())
541+ remaining = max (0.0 , end - time .time ())
545542 if remaining == 0.0 :
546543 return False
547544 self ._active_task_cv .wait (timeout = remaining )
You can’t perform that action at this time.
0 commit comments