mirror of
https://github.com/trafficlunar/api.git
synced 2026-06-27 22:24:08 +00:00
feat: add /status route
This commit is contained in:
parent
7a8a229f0e
commit
aaa8640aaf
7 changed files with 122 additions and 3 deletions
20
internal/worker/status.go
Normal file
20
internal/worker/status.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package worker
|
||||
|
||||
import (
|
||||
"backend/internal/model"
|
||||
"backend/internal/service"
|
||||
"log/slog"
|
||||
"time"
|
||||
)
|
||||
|
||||
var StatusData model.StatusData
|
||||
|
||||
func StartStatusWorker() {
|
||||
slog.Info("Starting status worker...")
|
||||
StatusData = service.GetStatuses()
|
||||
|
||||
for range time.Tick(5 * time.Minute) {
|
||||
slog.Info("Requesting Uptime Kuma...")
|
||||
StatusData = service.GetStatuses()
|
||||
}
|
||||
}
|
||||
|
|
@ -2,4 +2,5 @@ package worker
|
|||
|
||||
func StartWorkers() {
|
||||
go StartLastFMWorker()
|
||||
go StartStatusWorker()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue