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.
In this PR, we're trying to rectify test flakes in the recoverer
From testing the old code, I wasn't sure of the expected behaviour of the recoverer, specifically:
In the previous implementation of the recoverer, if the wrapped service completed execution without error, the recoverer would block until it was explicitly closed by a client. In this version, the recoverer shuts down once the wrapped service completes without error.
Also in the previous implementation of the recoverer, if the wrapped service errored, the recoverer would do nothing and block until it was explicitly closed by a client. In this version, the recoverer tries to recover the wrapped service when the wrapped service errors.
The reason I wasn't really clear what should happen, is because the old tests we had seemed to imply similar functionality for panic and error scenarios, but the behaviour defined in the implementation didn't really align with that?
Either way, it's easy to have this recover on panic and errors, or one or the other. I've ran these new tests thousands of times locally and I'm not seeing the deadlock anymore; previously, I saw the deadlock in around 1 in 500 runs.