From 133c8db6be677577062d4a3476aab82eecf2f9ee Mon Sep 17 00:00:00 2001 From: cryptorugmunch Date: Wed, 8 Jul 2026 13:19:17 +0200 Subject: [PATCH] feat(lifespan): wire data pipeline as optional background task MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step 8 in startup — controlled by DATA_PIPELINE=true env var. Runs RPC health checks + 6 block/event indexers. --- app/lifespan.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/lifespan.py b/app/lifespan.py index 5b94390..e44cd6a 100644 --- a/app/lifespan.py +++ b/app/lifespan.py @@ -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