[11.x] Pass the limiter to the when & report callbacks #56129
Merged
+4
−4
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.
It would be nice to have the limiter in the when & report callbacks to expand the logic in the closures to give a bit more control.
Here is a use case:
I want to give the job the maxAttempts to recover, but on that last try, it would be nice to report what is happening. I would like not to report the attempts 1...(max - 1), but on max, I would like to report. If I had the limiter in my closure, then I would know when to return true. This would keep the logs clean for the occasional exception that self-recover.
I have started a discussion on this at #56128, but then I thought that would make the simple PR.
I did not see where the tests were making any assertions about the parameters being passed, so I did not make any test changes. However, I will be happy to expand them if needed.