From 70fe3d0268e91a99422742b863dfda32ed2daffd Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Thu, 8 Sep 2022 09:35:58 -0400 Subject: [PATCH] checkin on daemon start --- netclient/functions/mqpublish.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netclient/functions/mqpublish.go b/netclient/functions/mqpublish.go index 3eddfa57..8ee1cf6e 100644 --- a/netclient/functions/mqpublish.go +++ b/netclient/functions/mqpublish.go @@ -26,13 +26,16 @@ import ( func Checkin(ctx context.Context, wg *sync.WaitGroup) { logger.Log(2, "starting checkin goroutine") defer wg.Done() + checkin() + ticker := time.NewTicker(time.Second * 60) + defer ticker.Stop() for { select { case <-ctx.Done(): logger.Log(0, "checkin routine closed") return //delay should be configuraable -> use cfg.Node.NetworkSettings.DefaultCheckInInterval ?? - case <-time.After(time.Second * 60): + case <-ticker.C: checkin() } }