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

Better handling of event stream errors #5

Merged
merged 5 commits into from
Sep 15, 2021

Conversation

bchatelard
Copy link
Member

If an individual event stream fails, the error is not properly propagated to the reconciler.
The error is muted, and the reconciler continue to pull events from other stream without restarting or notifying the caller.

If an individual event stream fails, the error is not properly propagated to the reconciler.
The error is muted, and the reconciler continue to pull events from other stream without restarting or notifying the caller.
@bchatelard bchatelard force-pushed the better-eventstream-error-handling branch from ff0dd70 to 6d3bb07 Compare September 15, 2021 11:56
@bchatelard bchatelard changed the title Can cancelStream when one of the stream is failing Better handling of event stream errors Sep 15, 2021
Copy link

@novln novln left a comment

Choose a reason for hiding this comment

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

LGFM 👍

Copy link
Contributor

@lahabana lahabana left a comment

Choose a reason for hiding this comment

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

LGTM would be perfect with a test :)

c.workerWaitGroup.Wait()
c.Info("stopped workers...")
c.Info("stopped controller...")
close(errChan)
Copy link
Contributor

@lahabana lahabana Sep 15, 2021

Choose a reason for hiding this comment

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

NIT:
Is there a specific motiviation for moving this into defer?
I find defer makes the code harder to read so I prefer to avoid it when possible (an err var might just make things work)

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea was to be able to return directly the error instead of storing and returning the error later (my previous version not commited).

controller.go Outdated
@@ -72,24 +88,19 @@ func (c *controller) Run(ctx context.Context) error {
err := stream.Subscribe(streamCtx, MeteredEventHandler(c.Observability.Meter, n, EventHandlerFunc(c.enqueue)))
if err != nil {
c.Error("Failed subscribing to stream", "error", err)
Copy link
Contributor

@lahabana lahabana Sep 15, 2021

Choose a reason for hiding this comment

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

Nit: Maybe worth adding the streamId to the log message.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@bchatelard
Copy link
Member Author

Thanks for the review, I improved the logging, and added a test

@bchatelard bchatelard merged commit 0519576 into koyeb:main Sep 15, 2021
@bchatelard bchatelard deleted the better-eventstream-error-handling branch September 15, 2021 17:14
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