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 beat exit #771

Merged
merged 1 commit into from
Jan 20, 2016
Merged

Refactor beat exit #771

merged 1 commit into from
Jan 20, 2016

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented Jan 19, 2016

  • Introduce Signal function which is called if using CTRL-C or similar
  • Run now returns an error and doesn't exist itself anymore
  • Fix spooler and crawler shutdown issue

Thanks to @cyrilleverrier for his contribution here.

@ruflin ruflin added the review label Jan 19, 2016
@ruflin
Copy link
Member Author

ruflin commented Jan 19, 2016

@cyrilleverrier have a look

@cyrilleverrier
Copy link
Contributor

LGTM

var exit int

func (b *Beat) Signal() {
b.error = fmt.Errorf("Beat stop through signal")
Copy link
Member Author

Choose a reason for hiding this comment

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

@andrewkroh @urso this is called when the beat exists through CTRL-C. What should the exit code be in your opinion? 1 or 0?

Copy link

Choose a reason for hiding this comment

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

since we use the kill signal to shutdown our beats, I'd assume it to be 0.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, will remove the error again in this case.

Copy link
Member

Choose a reason for hiding this comment

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

I would expect 0 on a clean shutdown triggered by signal.

* Introduce Signal function which is called if using CTRL-C or similar
* Run now returns an error and doesn't exist itself anymore
* Fix spooler and crawler shutdown issue
* Update mockbeat to check Run return error.

Thanks to @cyrilleverrier for his contribution here.
err := beat.Run(Name, "", winlogbeat.New())
if err != nil {
os.Exit(1)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be done in all Beats, right?

tsg added a commit that referenced this pull request Jan 20, 2016
@tsg tsg merged commit e2169fb into elastic:master Jan 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants