Skip to content

Commit 482c942

Browse files
committed
Remove timeout on initial attempts to shutdown units or revert context; add timeout for context revert second attempt.
1 parent 772c047 commit 482c942

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/ezmsg/core/backendprocess.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,22 +311,22 @@ async def shutdown_units() -> None:
311311

312312
shutdown_future = asyncio.run_coroutine_threadsafe(shutdown_units(), loop=loop)
313313
try:
314-
shutdown_future.result(timeout=5.0)
314+
shutdown_future.result()
315315
except KeyboardInterrupt:
316+
logger.warning("Interrupted during unit shutdown. This may indicate units with slow shutdown methods."
317+
"Re-trying... Press ctrl-c again to terminate immediately.")
316318
shutdown_future.result()
317-
except TimeoutError:
318-
logger.warning("Timed out waiting for unit shutdown")
319-
320-
# for cache in MessageCache.values():
321-
# cache.clear()
322319

323320
revert_future = asyncio.run_coroutine_threadsafe(context.revert(), loop=loop)
324321
try:
325-
revert_future.result(timeout=5.0)
326-
except KeyboardInterrupt:
327322
revert_future.result()
328-
except TimeoutError:
329-
logger.warning("Timed out waiting for context revert")
323+
except KeyboardInterrupt:
324+
logger.warning("Interrupted during context revert."
325+
"Re-trying... (will timeout in 10 seconds)")
326+
try:
327+
revert_future.result(timeout=10.0)
328+
except TimeoutError:
329+
logger.warning("Timed out waiting for retry on context revert")
330330

331331
logger.debug(f"Remaining tasks in event loop = {asyncio.all_tasks(loop)}")
332332

0 commit comments

Comments
 (0)