-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Refactor beat exit #771
Conversation
@cyrilleverrier have a look |
LGTM |
var exit int | ||
|
||
func (b *Beat) Signal() { | ||
b.error = fmt.Errorf("Beat stop through signal") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) | ||
} |
There was a problem hiding this comment.
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?
Thanks to @cyrilleverrier for his contribution here.