Skip to content

[Hold for next release] Use the shared QueueBase worker loop - #192

Draft
niemyjski wants to merge 9 commits into
mainfrom
feature/queue-worker-loop
Draft

niemyjski wants to merge 9 commits into
mainfrom
feature/queue-worker-loop

Conversation

@niemyjski

Copy link
Copy Markdown
Member

Follow-up to #190 (Queue GroupId). Hold for the next release. Depends on FoundatioFx/Foundatio#584. Stacked on feature/queue-group-id; GitHub retargets it to main once #190 merges.

What

Deletes this provider's copy of the StartWorkingAsync loop and calls the shared QueueBase.StartWorker(...) from StartWorkingImpl. The private _workerErrorCount field is replaced by QueueBase.WorkerErrorCount / ResetWorkerErrorCount().

The result: dequeue errors back off (1s doubling to 30s, with jitter) instead of retrying on a fixed interval or stopping the worker, abandon/auto-complete failures go through the resilience policy and don't stop the worker, and cancellation stops it without counting an error.

References the 13.0.5-preview.queue-worker-loop.0.19 core and TestHarness preview packages. Switch back to the released package before merging.

Risk

Behavior change only in worker error handling. Enqueue, dequeue, complete, abandon and dead-letter paths are unchanged.

Tests

Adds overrides for the new shared tests (StartWorkingAsync_WhenDequeueThrows_KeepsWorkingAsync, StartWorkingAsync_WhenAbandonThrows_KeepsWorkingAsync, StartWorkingAsync_WhenCancelled_StopsWithoutWorkerErrorsAsync). The full suite passed twice locally against the emulator, and the worker tests passed 10 consecutive runs.

…ness

The GroupId APIs are not in 13.0.4. Use the nightly until a release is available.
The Redis worker loop logged dequeue errors and immediately looped again without counting them. It now counts them, ignores cancellation only when its own token is cancelled, and waits one second before retrying. Documents why the delayed-retry GroupId test is skipped: Redis requeues delayed retries in the minute-interval maintenance task.
Deletes the provider-specific StartWorkingImpl loop in favor of QueueBase.StartWorker (backoff on dequeue errors, cancellation-safe stop, safe abandon/auto-complete) and runs the shared worker fault-injection tests. Requires the Foundatio core change on feature/queue-worker-loop.
@niemyjski
niemyjski force-pushed the feature/queue-worker-loop branch from 3ac57da to 1b54fcb Compare October 8, 2026 22:01
Base automatically changed from feature/queue-group-id to main October 14, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant