From b6e0a860ae0c7cb80871af02661e5eba788af292 Mon Sep 17 00:00:00 2001 From: walkerwmanuel Date: Mon, 27 Feb 2023 14:52:50 -0500 Subject: [PATCH] Added more accurate startup logs --- main.go | 9 +++++++-- mq/publishers.go | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 215028f4..7d62eddb 100644 --- a/main.go +++ b/main.go @@ -165,9 +165,14 @@ func startControllers() { // Should we be using a context vice a waitgroup???????????? func runMessageQueue(wg *sync.WaitGroup) { defer wg.Done() - brokerHost, secure := servercfg.GetMessageQueueEndpoint() - logger.Log(0, "connecting to mq broker at", brokerHost, "with TLS?", fmt.Sprintf("%v", secure)) + brokerHost, _ := servercfg.GetMessageQueueEndpoint() + logger.Log(0, "connecting to mq broker at", brokerHost) mq.SetupMQTT() + if mq.IsConnected() { + logger.Log(0, "connected to MQ Broker") + } else { + logger.FatalLog("error connecting to MQ Broker") + } ctx, cancel := context.WithCancel(context.Background()) go mq.Keepalive(ctx) go func() { diff --git a/mq/publishers.go b/mq/publishers.go index ae71e79b..bd160b15 100644 --- a/mq/publishers.go +++ b/mq/publishers.go @@ -388,7 +388,7 @@ func getCustomDNS(network string) []models.DNSUpdate { func sendPeers() { hosts, err := logic.GetAllHosts() - if err != nil { + if err != nil && len(hosts) > 0 { logger.Log(1, "error retrieving networks for keepalive", err.Error()) }