diff options
Diffstat (limited to 'services/order-executor')
| -rw-r--r-- | services/order-executor/src/order_executor/main.py | 6 |
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: |
