This commit is contained in:
@@ -6,6 +6,7 @@ Modular architecture with webhook processing and intelligent date handling
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
from datetime import datetime, timezone
|
||||
|
||||
@@ -34,6 +35,8 @@ from webhooks.webhook_batcher import WebhookBatcher
|
||||
# Import API routes
|
||||
from api.routes import register_routes
|
||||
|
||||
# Global shutdown event for graceful shutdown coordination
|
||||
shutdown_event = asyncio.Event()
|
||||
|
||||
def get_version() -> str:
|
||||
"""Get application version"""
|
||||
@@ -107,7 +110,8 @@ def initialize_components():
|
||||
"batcher": batcher,
|
||||
"start_time": start_time,
|
||||
"config": config,
|
||||
"version": get_version()
|
||||
"version": get_version(),
|
||||
"shutdown_event": shutdown_event
|
||||
}
|
||||
|
||||
|
||||
@@ -115,6 +119,9 @@ def signal_handler(signum, frame):
|
||||
"""Handle shutdown signals gracefully"""
|
||||
_log("INFO", f"Received signal {signum}, shutting down gracefully...")
|
||||
|
||||
# Set shutdown event to notify background tasks
|
||||
shutdown_event.set()
|
||||
|
||||
# Get the global dependencies if they exist
|
||||
if hasattr(signal_handler, 'dependencies') and signal_handler.dependencies:
|
||||
deps = signal_handler.dependencies
|
||||
|
||||
Reference in New Issue
Block a user