Skip to content

Commit

Permalink
cancel future and wait for it
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Jan 1, 2025
1 parent 92d0cc5 commit 7adfc0a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/datachain/asyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Iterable,
Iterator,
)
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import ThreadPoolExecutor, wait
from heapq import heappop, heappush
from typing import Any, Callable, Generic, Optional, TypeVar

Expand Down Expand Up @@ -179,6 +179,7 @@ def iterate(self, timeout=None) -> Generator[ResultT, None, None]:
self.shutdown_producer()
if not async_run.done():
async_run.cancel()
wait([async_run])

def __iter__(self):
return self.iterate()
Expand Down

0 comments on commit 7adfc0a

Please sign in to comment.