fix: shutdown hangs
This commit is contained in:
@@ -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}")
|
||||||
|
|||||||
Reference in New Issue
Block a user