Worker: Fix code flow in 'asleep' state
This commit is contained in:
parent
dfd55914b2
commit
d6df00db3e
@ -63,7 +63,8 @@ func (w *Worker) runStateAsleep(ctx context.Context) {
|
|||||||
|
|
||||||
resp, err := w.client.WorkerStateWithResponse(ctx)
|
resp, err := w.client.WorkerStateWithResponse(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("error checking upstream state changes")
|
log.Warn().Err(err).Msg("error checking upstream state changes")
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
case resp.JSON200 != nil:
|
case resp.JSON200 != nil:
|
||||||
@ -74,13 +75,11 @@ func (w *Worker) runStateAsleep(ctx context.Context) {
|
|||||||
return
|
return
|
||||||
case resp.StatusCode() == http.StatusNoContent:
|
case resp.StatusCode() == http.StatusNoContent:
|
||||||
log.Debug().Msg("we can keep sleeping")
|
log.Debug().Msg("we can keep sleeping")
|
||||||
continue
|
|
||||||
default:
|
default:
|
||||||
log.Warn().
|
log.Warn().
|
||||||
Int("code", resp.StatusCode()).
|
Int("code", resp.StatusCode()).
|
||||||
Str("error", string(resp.Body)).
|
Str("error", string(resp.Body)).
|
||||||
Msg("unable to obtain requested state for unknown reason")
|
Msg("unable to obtain requested state for unknown reason")
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user