From 6332b3ee71d3d27e2f2461689989959e58672de9 Mon Sep 17 00:00:00 2001 From: Null User Date: Tue, 26 Oct 2021 13:37:56 +0000 Subject: [PATCH 1/2] Fix the crash in #39 --- cmd/stayrtr/stayrtr.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/stayrtr/stayrtr.go b/cmd/stayrtr/stayrtr.go index 50abe79..1dc09ff 100644 --- a/cmd/stayrtr/stayrtr.go +++ b/cmd/stayrtr/stayrtr.go @@ -536,6 +536,7 @@ func run() error { s := state{ server: server, + lastdata: &prefixfile.VRPList{}, metricsEvent: me, sendNotifs: *SendNotifs, checktime: *TimeCheck, From 76eac7450abd6bc2c90f5c32590ccc7b208679a9 Mon Sep 17 00:00:00 2001 From: Null User Date: Tue, 26 Oct 2021 14:14:55 +0000 Subject: [PATCH 2/2] Refresh faster when the VRPs weren't downloaded on init --- cmd/stayrtr/stayrtr.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/stayrtr/stayrtr.go b/cmd/stayrtr/stayrtr.go index 1dc09ff..6effad4 100644 --- a/cmd/stayrtr/stayrtr.go +++ b/cmd/stayrtr/stayrtr.go @@ -379,6 +379,10 @@ func (s *state) routineUpdate(file string, interval int, slurmFile string) { signal.Notify(signals, syscall.SIGHUP) for { delay := time.NewTimer(time.Duration(interval) * time.Second) + if (s.lastchange.IsZero()) { + log.Warn("Initial sync not complete. Refreshing every 30 seconds") + delay = time.NewTimer(time.Duration(30) * time.Second) + } select { case <-delay.C: case <-signals: