Add reset endpoint
This commit is contained in:
parent
5d07060a78
commit
cc20e1c09a
10
main.go
10
main.go
@ -148,6 +148,7 @@ func startHTTPServer() *http.Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
http.HandleFunc("/status", handleStatus)
|
http.HandleFunc("/status", handleStatus)
|
||||||
|
http.HandleFunc("/reset", handleReset)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if err := srv.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) {
|
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() {
|
func updateSystemStatus() {
|
||||||
statusMutex.Lock()
|
statusMutex.Lock()
|
||||||
defer statusMutex.Unlock()
|
defer statusMutex.Unlock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user