From 2ab023b1d6c4c89d564f66a6f3552398d1c7601b Mon Sep 17 00:00:00 2001 From: Ezri Zhu Date: Thu, 14 Nov 2024 02:20:38 -0500 Subject: [PATCH] fetch interval --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 25307d2..e585e16 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ var port int var appId string var debug bool var jsonLog bool +var fetchInterval int const ripestatBase = "https://stat.ripe.net" @@ -67,6 +68,7 @@ func init() { flag.IntVar(&port, "port", 2112, "port") flag.BoolVar(&debug, "debug", false, "debug") flag.BoolVar(&jsonLog, "json", false, "json logging") + flag.IntVar(&fetchInterval, "i", 15, "fetch interval") } func main() { @@ -92,7 +94,7 @@ func main() { updateStates() go func() { - ticker := time.NewTicker(1 * time.Minute) + ticker := time.NewTicker(time.Duration(fetchInterval) * time.Second) defer ticker.Stop() for range ticker.C {