From cc20e1c09af19707b4b7da798716e96fa023a5b2 Mon Sep 17 00:00:00 2001
From: Sebastiaan de Schaetzen <sebastiaan.de.schaetzen@gmail.com>
Date: Wed, 2 Apr 2025 10:25:52 +0200
Subject: [PATCH] Add reset endpoint

---
 main.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

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()