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

Add support for closing publisher.Client #1402

Merged
merged 14 commits into from
Apr 20, 2016
Prev Previous commit
Next Next commit
Winlogbeat close publisher.client
  • Loading branch information
urso committed Apr 19, 2016
commit d00bf85189e88a708306f4758eb79d904eb31f00
1 change: 1 addition & 0 deletions winlogbeat/beater/winlogbeat.go
Original file line number Diff line number Diff line change
@@ -175,6 +175,7 @@ func (eb *Winlogbeat) Stop() {
logp.Info("Stopping Winlogbeat")
if eb.done != nil {
close(eb.done)
eb.client.Close()
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 I have some incorrect error handling here.

(Making assumptions here because I haven't reviewed everything yet) When the publisher client closes some PublishEvents() calls might fail and return false. So I need to return from here to prevent any state from being persisted in the registry for the failed events. WDYT?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, something's fishy here. using 'Sync' + 'Guaranteed'. The only reason for having ok == false is the publisher client being closed. That is in main loop we've to break the loop on '!ok'

}
}