summaryrefslogtreecommitdiff
path: root/services/order-executor/src/order_executor
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-02 15:42:12 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-02 15:42:12 +0900
commit0e177eafbed026445e50da6a5992177521fb8212 (patch)
tree84b648112917e05a80fe8e9743c6a66d2259764a /services/order-executor/src/order_executor
parent913de6b1934881c0a8ee978cf6a0cfd664e1df9a (diff)
feat: add graceful shutdown with SIGTERM/SIGINT handlers to all services
Diffstat (limited to 'services/order-executor/src/order_executor')
-rw-r--r--services/order-executor/src/order_executor/main.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/services/order-executor/src/order_executor/main.py b/services/order-executor/src/order_executor/main.py
index 1d167ef..63d93bc 100644
--- a/services/order-executor/src/order_executor/main.py
+++ b/services/order-executor/src/order_executor/main.py
@@ -11,6 +11,7 @@ from shared.healthcheck import HealthCheckServer
from shared.logging import setup_logging
from shared.metrics import ServiceMetrics
from shared.notifier import TelegramNotifier
+from shared.shutdown import GracefulShutdown
from order_executor.config import ExecutorConfig
from order_executor.executor import OrderExecutor
@@ -83,6 +84,9 @@ async def run() -> None:
await broker.ensure_group(stream, GROUP)
+ shutdown = GracefulShutdown()
+ shutdown.install_handlers()
+
log.info("started", stream=stream, dry_run=config.dry_run)
try:
@@ -97,7 +101,7 @@ async def run() -> None:
except Exception as exc:
log.error("pending_failed", error=str(exc), msg_id=msg_id)
- while True:
+ while not shutdown.is_shutting_down:
messages = await broker.read_group(stream, GROUP, CONSUMER, count=10, block=5000)
for msg_id, msg in messages:
try: