Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Batcher): Add Limiter option #427

Merged
merged 4 commits into from
Aug 22, 2023
Merged

feat(Batcher): Add Limiter option #427

merged 4 commits into from
Aug 22, 2023

Conversation

bartelink
Copy link
Collaborator

Adds a facility to the Batcher that (optionally) extends the Linger period to include a phase during which a SemaphoreSlim is acquired:

  • the semaphore is Released when the processing has finished
  • further items can join the lingering batch during the acquisition period

Copy link
Contributor

@nordfjord nordfjord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it still surprises me that his stuff isn't available in the stdlib 🥴

@bartelink
Copy link
Collaborator Author

It definitely feels like a cleaner impl should be possible, and I'm also surprised I have not ran into anything similar.
Being able to leave it open while there's batches in flight is definitely a big upgrade on trying 5/10/50/100 and convincing oneself that such a linger time makes sense overall in the context of some anticipated load

Base automatically changed from stats-a to master August 22, 2023 08:19
@bartelink bartelink merged commit 3b53435 into master Aug 22, 2023
3 of 4 checks passed
@bartelink bartelink deleted the batcher-limiter branch August 22, 2023 09:02
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.

2 participants