Skip to content

fix(worker): consume live work while tasks are active - #28

Merged
psteinroe merged 1 commit into
mainfrom
fix/map
Sep 18, 2026
Merged

psteinroe merged 1 commit into
mainfrom
fix/map

Conversation

@psteinroe

@psteinroe psteinroe commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Keep worker execution capacity available for queue items that arrive while another task is still running.

mapConcurrent() retains its existing fillSlots() and result-processing flow. Live queues may optionally expose a one-shot, non-consuming onNextItemAvailable() callback. While mapper capacity is available, mapConcurrent() races that callback against active task completion and refills its existing slots when notified.

Queue lifecycle

Stopping mapConcurrent() only unsubscribes its callback. It does not read, close, flush, or discard queue contents. Existing queue close() behavior is unchanged, and sources without the optional callback retain the previous polling behavior.

Tests cover live arrivals, early consumer exit with a reusable source, and preservation of pending batches.

@psteinroe
psteinroe merged commit c1235b2 into main Sep 18, 2026
9 checks passed
@psteinroe
psteinroe deleted the fix/map branch September 18, 2026 11:25
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