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

PoC: auto-restart services failed within okaydelay when startup is enabled #517

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions internals/overlord/servstate/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,16 @@ func (s *serviceData) start() error {
if err != nil {
return err
}
s.transition(stateStarting)
time.AfterFunc(okayDelay, func() { logError(s.okayWaitElapsed()) })
if s.config.Startup == plan.StartupEnabled {
// If a service is configured with `startup: enabled`, skip the stateStarting/okayDelay
// and transition it into the running state, so that even if it fails within okayDelay,
// Pebble will still restart it.
s.started <- nil
s.transition(stateRunning)
} else {
s.transition(stateStarting)
time.AfterFunc(okayDelay, func() { logError(s.okayWaitElapsed()) })
}

default:
return fmt.Errorf("cannot start service while %s", s.state)
Expand Down
Loading