Maint: make all set status context aware

This commit is contained in:
Quentin McGaw (desktop)
2021-07-16 00:49:59 +00:00
parent 6bbb7c8f7d
commit 0ed738cd61
16 changed files with 146 additions and 57 deletions

View File

@@ -1,6 +1,7 @@
package server
import (
"context"
"encoding/json"
"net/http"
"strings"
@@ -10,15 +11,18 @@ import (
)
func newUpdaterHandler(
ctx context.Context,
looper updater.Looper,
logger logging.Logger) http.Handler {
return &updaterHandler{
ctx: ctx,
looper: looper,
logger: logger,
}
}
type updaterHandler struct {
ctx context.Context
looper updater.Looper
logger logging.Logger
}
@@ -63,7 +67,7 @@ func (h *updaterHandler) setStatus(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
outcome, err := h.looper.SetStatus(status)
outcome, err := h.looper.SetStatus(h.ctx, status)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return