Merge 'shutdown' and 'offline' states
Move the 'shutdown' state code to the 'offline' state, to match the removal of the 'shutdown' state from the OpenAPI definition.
This commit is contained in:
parent
cf8b4e18b1
commit
132ce8f2ec
@ -149,7 +149,7 @@ func (f *Flamenco) SignOff(e echo.Context) error {
|
||||
w := requestWorkerOrPanic(e)
|
||||
prevStatus := w.Status
|
||||
w.Status = api.WorkerStatusOffline
|
||||
if w.StatusRequested == api.WorkerStatusShutdown {
|
||||
if w.StatusRequested == api.WorkerStatusOffline {
|
||||
w.StatusRequested = ""
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,11 @@ import (
|
||||
"git.blender.org/flamenco/pkg/api"
|
||||
)
|
||||
|
||||
func (w *Worker) gotoStateShutdown(context.Context) {
|
||||
func (w *Worker) gotoStateOffline(context.Context) {
|
||||
w.stateMutex.Lock()
|
||||
defer w.stateMutex.Unlock()
|
||||
|
||||
w.state = api.WorkerStatusShutdown
|
||||
w.state = api.WorkerStatusOffline
|
||||
|
||||
logger := log.With().Int("pid", os.Getpid()).Logger()
|
||||
proc, err := os.FindProcess(os.Getpid())
|
||||
@ -26,7 +26,7 @@ func (w *Worker) gotoStateShutdown(context.Context) {
|
||||
logger.Warn().Msg("sending our own process an interrupt signal")
|
||||
err = proc.Signal(os.Interrupt)
|
||||
if err != nil {
|
||||
logger.Fatal().Err(err).Msg("unable to find send interrupt signal to our own process")
|
||||
logger.Fatal().Err(err).Msg("unable to send interrupt signal to our own process")
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ func (w *Worker) gotoStateShutdown(context.Context) {
|
||||
// Does NOT actually peform a shutdown; is intended to be called while shutdown is in progress.
|
||||
func (w *Worker) SignOff(ctx context.Context) {
|
||||
w.stateMutex.Lock()
|
||||
w.state = api.WorkerStatusShutdown
|
||||
w.state = api.WorkerStatusOffline
|
||||
logger := log.With().Str("state", string(w.state)).Logger()
|
||||
w.stateMutex.Unlock()
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
func (w *Worker) setupStateMachine() {
|
||||
w.stateStarters[api.WorkerStatusAsleep] = w.gotoStateAsleep
|
||||
w.stateStarters[api.WorkerStatusAwake] = w.gotoStateAwake
|
||||
w.stateStarters[api.WorkerStatusShutdown] = w.gotoStateShutdown
|
||||
w.stateStarters[api.WorkerStatusOffline] = w.gotoStateOffline
|
||||
}
|
||||
|
||||
// Called whenever the Flamenco Manager has a change in current status for us.
|
||||
|
Loading…
x
Reference in New Issue
Block a user