feat(RedisBroker): poll for unacked events #11004
Open
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.
Initially, as the branch name implies, I wanted to handle cases where a service is downscaled, potentially leaving some events orphaned (if Redis had already deemed they were owned by that consumer). As I wrote the logic though, I realized we effectively end up reading "dead events" (i.e. caused by a crash mid processing) that belong to the current consumer too!
As such, this actually supersedes #11003
One thing that's a bit of a TODO (probably not for this PR though, I'll keep iterating some more first) is to add a section in the README that warns users about dangerous
ack
usage (e.g. if you default on always acking at the very end of your logic, you risk duplicating certain actions, like database entries maybe; while acking at the very beginning is an opt-out of recovery logic). There's use cases to acking in all sorts of contexts, but I think we should describe them and recommend that users exercise caution.Funnily, this could also serve as a workaround for #11001, but that one is still arguably important.