Skip to content

Commit 2ad96e3

Browse files
committed
feedback import
Signed-off-by: Filinto Duran <[email protected]>
1 parent ba81e52 commit 2ad96e3

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

durabletask/worker.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import logging
77
import os
88
import random
9+
import threading
10+
import time
911
from concurrent.futures import ThreadPoolExecutor
1012
from datetime import datetime, timedelta
1113
from 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)

0 commit comments

Comments
 (0)