Skip to content

Commit

Permalink
fetch interval
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Nov 14, 2024
1 parent 73cd3c7 commit 2ab023b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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() {
Expand All @@ -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 {
Expand Down

0 comments on commit 2ab023b

Please sign in to comment.