Parcourir la source

revert the mq setttings back

Max Ma il y a 1 an
Parent
commit
3a10c88f20
1 fichiers modifiés avec 5 ajouts et 5 suppressions
  1. 5 5
      mq/mq.go

+ 5 - 5
mq/mq.go

@@ -34,8 +34,8 @@ func setMqOptions(user, password string, opts *mqtt.ClientOptions) {
 	opts.SetAutoReconnect(true)
 	opts.SetConnectRetry(true)
 	opts.SetCleanSession(true)
-	opts.SetConnectRetryInterval(time.Second * 3)
-	opts.SetKeepAlive(time.Second * 5)
+	opts.SetConnectRetryInterval(time.Second * 4)
+	opts.SetKeepAlive(time.Minute)
 	opts.SetCleanSession(true)
 	opts.SetWriteTimeout(time.Minute)
 }
@@ -96,9 +96,9 @@ func SetupMQTT(fatal bool) {
 	})
 	opts.SetConnectionLostHandler(func(c mqtt.Client, e error) {
 		slog.Warn("detected broker connection lost", "err", e.Error())
-		// c.Disconnect(250)
-		// slog.Info("re-initiating MQ connection")
-		// SetupMQTT(false)
+		c.Disconnect(250)
+		slog.Info("re-initiating MQ connection")
+		SetupMQTT(false)
 
 	})
 	mqclient = mqtt.NewClient(opts)