Repository navigation
fix: prevent looping on poisoned messages (if worker crashes) - #18
GuillaumeDecMeetsMore merged 9 commits into
Conversation
| * Decision for a poisoned message | ||
| */ | ||
| export type PoisonedMessageDecision = | ||
| | { action: 'not-poisoned' } |
There was a problem hiding this comment.
a bit of a semantic nit, but i feel like action should be a clear indication of what happens, which dead-letter and discard are, but not-poisoned is a state
either we define the decision for all 3 as "action to be taken", or if action to be taken is delegated outside of matador, then we define state for all 3
this is a bit pedantic on my part though
(also, do we use deadletter or dead-letter in the codebase?)
There was a problem hiding this comment.
Yeah, I wasn't/I am not really sure what to use there. Initially, I was tempted to use continue or pass-through as the action, but both of them don't really work in both cases:
- In the
precheckflow, "continue" and "pass-through" make sense - In the
shouldRetryflow (after getting an error), it makes less sense. We don't reallycontinuethere, but that wording seem to suggest that "we don't care about the error and do nothing", which we don't have as a flow 😕
For deadletter vs dead-letter, I've used the same wording as the RetryDecision just above. But it does look like we use dead-letter as well in other places 🤔
There was a problem hiding this comment.
maybe just not using the term action is enough
{ type: `ok` | `deadletter` | `discard` }
lord knows why im making this nitpick when code probably wont exist in 12 months 😅
* refactor precheck naming * reduce code duplication for failure handling
Tested locally on our use case