From 93517549b0b60ccffa103591787765a056e888a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 15 Feb 2022 15:56:38 +0100 Subject: [PATCH] Manager: actually return worker state in /api/worker/state endpoint --- internal/manager/api_impl/workers.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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.