fix: pipeline stop now halts all workers and flushes queues
Workers (ingestion, parser, extractor, aggregation, recommendation, broker, lake-publisher) now check the pipeline:enabled Redis flag on each loop iteration and sleep when disabled. The toggle endpoint flushes all pipeline queues on disable so queued jobs don't resume when workers eventually check. Broker/trading queues are excluded from flush to avoid dropping in-flight orders.
This commit is contained in:
@@ -23,6 +23,7 @@ from services.shared.logging import inject_trace_context, setup_logging
|
||||
from services.shared.redis_keys import (
|
||||
QUEUE_AGGREGATION,
|
||||
QUEUE_RECOMMENDATION,
|
||||
is_pipeline_enabled,
|
||||
queue_key,
|
||||
)
|
||||
|
||||
@@ -134,6 +135,10 @@ async def main() -> None:
|
||||
|
||||
try:
|
||||
while True:
|
||||
if not await is_pipeline_enabled(redis_client):
|
||||
await asyncio.sleep(1)
|
||||
continue
|
||||
|
||||
raw = await redis_client.lpop(queue)
|
||||
if raw is None:
|
||||
await asyncio.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user