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:
@@ -76,7 +76,7 @@ from services.shared.metrics import (
|
||||
RISK_CHECK_FAILURES,
|
||||
RISK_EVALUATIONS_TOTAL,
|
||||
)
|
||||
from services.shared.redis_keys import QUEUE_BROKER, queue_key
|
||||
from services.shared.redis_keys import QUEUE_BROKER, is_pipeline_enabled, queue_key
|
||||
|
||||
logger = logging.getLogger("broker_service")
|
||||
|
||||
@@ -923,6 +923,9 @@ async def main() -> None:
|
||||
|
||||
try:
|
||||
while True:
|
||||
if not await is_pipeline_enabled(rds):
|
||||
await asyncio.sleep(2)
|
||||
continue
|
||||
result = await rds.lpop(queue)
|
||||
raw = str(result) if result else None
|
||||
if raw:
|
||||
|
||||
Reference in New Issue
Block a user