diff --git a/internal/manager/api_impl/workers.go b/internal/manager/api_impl/workers.go index 303881eb..db18e8c9 100644 --- a/internal/manager/api_impl/workers.go +++ b/internal/manager/api_impl/workers.go @@ -160,8 +160,15 @@ func (f *Flamenco) SignOff(e echo.Context) error { // (GET /api/worker/state) func (f *Flamenco) WorkerState(e echo.Context) error { - // TODO: look up proper status in DB. - return e.String(http.StatusNoContent, "") + worker := requestWorkerOrPanic(e) + + if worker.StatusRequested == "" { + return e.String(http.StatusNoContent, "") + } + + return e.JSON(http.StatusOK, api.WorkerStateChange{ + StatusRequested: worker.StatusRequested, + }) } // Worker changed state. This could be as acknowledgement of a Manager-requested state change, or in response to worker-local signals.