Tags: ModelsLab/modelq-php
Tags
feat: add markTasksAsError for efficient bulk dead-load draining Bulk sibling of markTaskAsError that snapshots ml_tasks once and uses a targeted LREM per task instead of re-scanning the whole list per call, so a maintenance sweep can drain thousands of leaked queue entries cheaply. Skips the cancellation flag since callers use it for already-terminal tasks.
feat: add markTaskAsError to fail and drain a task from the queue When an external system of record (webhook-server timeout sweep, frontend /fetch give-up) marks a request errored, ModelQ must agree: drain the task from ml_tasks/queued_requests/processing_tasks and write a terminal failed state so no worker keeps (re)processing abandoned work. Closes the queued_requests leak for error/timeout paths (previously only clean completion removed the queue index).
feat: fully drain a task on removeTaskFromQueue (cancel) removeTaskFromQueue() only dropped queued_requests when the task was still present in ml_tasks. A cancelled/given-up task that had already left ml_tasks stayed in the queued_requests index (inflating queue_num/queue_time) and in processing_tasks. Now always zRem queued_requests + sRem processing_tasks so a cancelled task is neither counted nor retried, regardless of where it sits.
fix stuck processing_tasks and queued_requests leak
Mirrors modelq python 1.0.11:
- worker_loop: persist startedAt on Task and status='processing'
on task:{id} so storeFinalTaskState preserves them
- requeueStuckProcessingTasks: fall back to queued_at when
started_at is missing (covers workers crashed in SADD→SET window)
- storeFinalTaskState: zRem queued_requests on terminal state