fix: shutdown hangs

This commit is contained in:
2025-10-22 11:14:31 -04:00
committed by sbcrumb
parent ea69ad9202
commit 46465d1749
+6 -1
View File
@@ -196,7 +196,12 @@ class WebhookBatcher:
# Shutdown the thread pool executor # Shutdown the thread pool executor
try: try:
self.executor.shutdown(wait=True, timeout=10) # Wait up to 10 seconds # Use timeout parameter only if supported (Python 3.9+)
import sys
if sys.version_info >= (3, 9):
self.executor.shutdown(wait=True, timeout=10) # Wait up to 10 seconds
else:
self.executor.shutdown(wait=True) # No timeout for older Python versions
_log("INFO", "Thread pool executor shut down successfully") _log("INFO", "Thread pool executor shut down successfully")
except Exception as e: except Exception as e:
_log("WARNING", f"Error shutting down thread pool: {e}") _log("WARNING", f"Error shutting down thread pool: {e}")