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

Dead code? #51

Open
grembo opened this issue Dec 21, 2023 · 0 comments
Open

Dead code? #51

grembo opened this issue Dec 21, 2023 · 0 comments

Comments

@grembo
Copy link
Contributor

grembo commented Dec 21, 2023

It seems like nothing in nomad really calls this code - but since I'm no golang hero in any respect, I figured it's better to ask than to axe:

// shutdown shuts down the container, with `timeout` grace period
// before killing the container with SIGKILL.
func (h *taskHandle) shutdown(timeout time.Duration) error {
// Wait for the process to finish or kill it after a timeout (whichever happens first):
var fixTimeOut time.Duration
fixTimeOut = 5 * time.Second
h.procState = drivers.TaskStateExited
done := make(chan error, 1)
go func() {
done <- h.syexec.cmd.Wait()
}()
select {
case <-time.After(fixTimeOut * time.Second):
if err := h.syexec.cmd.Process.Kill(); err != nil {
return fmt.Errorf("failed to kill process: %v ", err)
}
case err := <-done:
if err != nil {
return fmt.Errorf("process finished with error = %v", err)
}
}
return nil
}

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

No branches or pull requests

1 participant