diff --git a/main.go b/main.go index 127d805..f0dea30 100644 --- a/main.go +++ b/main.go @@ -148,6 +148,7 @@ func startHTTPServer() *http.Server { } http.HandleFunc("/status", handleStatus) + http.HandleFunc("/reset", handleReset) go func() { if err := srv.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) { @@ -176,6 +177,15 @@ func handleStatus(w http.ResponseWriter, _ *http.Request) { } } +func handleReset(w http.ResponseWriter, _ *http.Request) { + statusMutex.Lock() + defer statusMutex.Unlock() + + nextSleepTime = time.Now().Add(monitoringPeriod) + blockers = []string{"blocked by HTTP"} + w.WriteHeader(http.StatusOK) +} + func updateSystemStatus() { statusMutex.Lock() defer statusMutex.Unlock()