Skip to content

BatchProcessor waits for whole batch unnecessarily #114

Closed

Description

@jumski

Current implementation of BatchProcessor have a faulty "back pressure" mechanic which only unlocks next polling interation of the worker when all of the pending tasks finishes and not when any of them finishes.

The correct implementation should allow poller to poll more tasks when any new execution slot fees up in internal promise queue.
We can also keep an internal "buffer" of messages so we always have some of them waiting for the exeuction slot and poll to fill - this will make it even faster, at the risk of exceeding the visibility timeout.

This was reported by Renaud on Discord: https://discord.com/channels/1330460493495795804/1369991442226876498

batching X concurrent tasks then waiting for them all to finish before starting a new batch (instead of picking tasks as soon as one finished). This is not great if some of the tasks are long as it means it will delay the next batch.

Activity

  1. self-assigned this
    on May 8, 2025
  2. added theissue type on May 8, 2025
  3. jumski commented on Oct 8, 2025

    @jumski
    ContributorAuthor

    This is parked because some reworks to Edge Worker are planned and this code will be affected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions