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.
Summary
References #4607
Changes
Publish
call, as the item may be queued, but the creation of a new worker may fail. The caller now doesn't know if he should attempt to resubmit the item or not. This also could have led to situations in which workers can no longer be created but items are still in the queuepanic
, in order to avoid falling behind the minimal number of workersPublish
, but during testing I've hit this particular issue when there can be at most 1 worker spawned at the time, it panics, and there are still items in the queue which are not processed untilPublish
is called againpkg/workerpool
Publish
did not fail is processed exactly oncePublish
did fail is not processedpkg/workerpool
The results on my machine are:
The way I interpret them is that queue 'physics' check out - if the producers have more PPS than the PPS that the pool can consume, the messages are dropped, and the delay for the queued items is minimal.
Testing
Unit testing for the first change, while introducing new tests for
pkg/workerpool
Regressions
This reverts back webhooks to a shared
*http.Client
, but no other changes are expected.Checklist
README.md
for the chosen target branch.CHANGELOG.md
.CONTRIBUTING.md
, there are no fixup commits left.