Repository navigation
Add DiscardAfterThreshold option for SizedGroup - #21
Merged
Merged
Conversation
DiscardAfterThreshold(n) accepts up to n calls in flight, running or waiting to run, and discards the rest. Go never blocks: accepted calls beyond the group size wait in their goroutines. A second semaphore of size n gates admission, released when the call's goroutine ends, including the canceled skip path. With n above the group size the option overrides Preemptive and Discard in any order, since either left on would block the caller or drop an admitted call holding its slot. With n at or below the group size, 0 included, it works as Discard. ErrSizedGroup treats it as Discard. Fixed #5
Coverage Report for CI Build 44025480166Coverage increased (+0.09%) to 99.015%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
adds
DiscardAfterThreshold(n)forSizedGroup, the mode between the default andDiscardasked for in #5. The group accepts up toncalls in flight, running or waiting to run, and discards the rest.Gonever blocks: accepted calls beyond the group size wait in their goroutines.it's a second semaphore of size
ntaken withTryLockinGoand released when the call's goroutine ends, the canceled skip path included. The run limit and the existing modes are untouched.nabove the group size overridesPreemptiveandDiscardpassed in any order. Either one left on would block the caller or drop an admitted call holding its slot.nat or below the group size, 0 and negatives included, works asDiscard, as Add DiscardWithThreshold support #5 specifies.ErrSizedGrouptreats it asDiscard.Fixed #5