Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: process upstream messages individually if push fails #483

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

yashmehrotra
Copy link
Member

No description provided.

// Process each event individually since upsteam.Push is idempotent
var failedIndividualEvents []api.Event
for _, e := range events {
failedIndividualEvents = append(failedIndividualEvents, t.Run(ctx, []api.Event{e})...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for the sake of simplicity we could avoid the recursive call in here. It would probably work in similar way I assume.

Copy link
Member

@adityathebe adityathebe Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now see that Run would otherwise receive a group of events, so t.Run makes sense here.
Maybe we need to do the same for failedEvents.

Or in general, any failed event should be handled individually. What do you think of modifying consumeEvents() so when it's fetching in batches, it's making sure it's not pulling any failed events. And if it is pulling any failed event it's doing that one at a time.

This way the consumers do not have to handle this in ProcessBatchFunc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all other consumers, although we process events in bulk, each event passed or fails individually in isolation. There is no need to handle failed events separately there

For upstream push, we are mixing N events into one function call, the entirety of which can fail leading to us not knowing which event was the culprit, this is why in that scenario, we are just reprocessing all again individually so that the other successful events don't get marked as failed due to the failed events

In other consumers, this is already handled in the implementation since events do not get mixed

@moshloop moshloop merged commit 6f807f1 into main Aug 7, 2023
5 checks passed
@moshloop moshloop deleted the upstream-err-ind-procss branch August 7, 2023 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants