summaryrefslogtreecommitdiff
path: root/services/data-collector/src
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/data-collector/src
parent913de6b1934881c0a8ee978cf6a0cfd664e1df9a (diff)
feat: add graceful shutdown with SIGTERM/SIGINT handlers to all services
Diffstat (limited to 'services/data-collector/src')
-rw-r--r--services/data-collector/src/data_collector/main.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/services/data-collector/src/data_collector/main.py b/services/data-collector/src/data_collector/main.py
index 608d6cd..171db52 100644
--- a/services/data-collector/src/data_collector/main.py
+++ b/services/data-collector/src/data_collector/main.py
@@ -11,6 +11,7 @@ from shared.logging import setup_logging
from shared.metrics import ServiceMetrics
from shared.models import Candle
from shared.notifier import TelegramNotifier
+from shared.shutdown import GracefulShutdown
from data_collector.config import CollectorConfig
@@ -83,10 +84,13 @@ async def run() -> None:
symbols = config.symbols
timeframe = config.timeframes[0] if config.timeframes else "1Day"
+ shutdown = GracefulShutdown()
+ shutdown.install_handlers()
+
log.info("starting", symbols=symbols, timeframe=timeframe, poll_interval=poll_interval)
try:
- while True:
+ while not shutdown.is_shutting_down:
# Check if market is open
try:
is_open = await alpaca.is_market_open()