Skip to content

Commit

Permalink
Run._wait() also returns during closing when called from the main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
kgodlewski authored and PatrykGala committed Jan 14, 2025
1 parent 4747e9d commit e840cf0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/neptune_scale/api/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,15 @@ def _wait(
# Handle the case where we get notified on `wait_seq` before we actually wait.
# Otherwise, we would unnecessarily block, waiting on a notify_all() that never happens.
if wait_seq.value >= self._operations_queue.last_sequence_id:
break
return True

if is_closing and threading.current_thread() != self._closing_thread:
if verbose:
logger.warning("Waiting interrupted by run termination")
if is_closing:
if threading.current_thread() != self._closing_thread:
if verbose:
logger.warning("Waiting interrupted by run termination")

self._close_completed.wait(wait_time)

self._close_completed.wait(wait_time)
return False

with wait_seq:
Expand Down

0 comments on commit e840cf0

Please sign in to comment.