From 4854cb2db9b10a861685ff9d77c35ef98a18ea00 Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Thu, 27 Jan 2022 15:52:31 -0500 Subject: [PATCH] fix typo --- mq/mq.go | 3 ++- netclient/functions/daemon.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mq/mq.go b/mq/mq.go index a5bbd961..df7fa02d 100644 --- a/mq/mq.go +++ b/mq/mq.go @@ -156,11 +156,12 @@ func SetupMQTT() mqtt.Client { opts := mqtt.NewClientOptions() broker := servercfg.GetMessageQueueEndpoint() opts.AddBroker(broker) + client := mqtt.NewClient(opts) tperiod := time.Now().Add(10 * time.Second) for { if token := client.Connect(); token.Wait() && token.Error() != nil { logger.Log(2, "unable to connect to broker, retrying ...") - if time.Now().Afer(tperiod) { + if time.Now().After(tperiod) { log.Fatal(0, "could not connect to broker, exiting ...", token.Error()) } } else { diff --git a/netclient/functions/daemon.go b/netclient/functions/daemon.go index 5d6400de..24f94d73 100644 --- a/netclient/functions/daemon.go +++ b/netclient/functions/daemon.go @@ -75,7 +75,7 @@ func SetupMQTT(cfg *config.ClientConfig) mqtt.Client { for { if token := client.Connect(); token.Wait() && token.Error() != nil { logger.Log(2, "unable to connect to broker, retrying ...") - if time.Now().Afer(tperiod) { + if time.Now().After(tperiod) { log.Fatal(0, "could not connect to broker, exiting ...", token.Error()) } } else {