feat(lifespan): wire data pipeline as optional background task

Step 8 in startup — controlled by DATA_PIPELINE=true env var.
Runs RPC health checks + 6 block/event indexers.
This commit is contained in:
Crypto Rug Munch 2026-07-08 13:19:17 +02:00
parent f2a50fdf71
commit 133c8db6be

View file

@ -95,6 +95,17 @@ async def lifespan(_app: FastAPI) -> AsyncIterator[None]:
except Exception as exc:
log.info("certstream_start_failed err=%s", exc)
# 8. Data Pipeline — RPC health + blockchain indexers (optional, env-controlled)
try:
if os.getenv("DATA_PIPELINE", "false").lower() == "true":
from app.data.pipeline import DataPipeline
import asyncio
pipe = DataPipeline()
asyncio.create_task(pipe.start())
log.info("data_pipeline_started")
except Exception as exc:
log.info("data_pipeline_skipped err=%s", exc)
yield
# Shutdown