add additional logging

This commit is contained in:
abhishek9686
2024-02-29 19:58:18 +07:00
parent 4630925182
commit 01592b2ecc
2 changed files with 5 additions and 2 deletions
+3 -2
View File
@@ -25,6 +25,7 @@ func Run() {
updateNodes()
updateAcls()
if os.Getenv("MIGRATE_EMQX") == "true" {
logger.Log(0, "migrating emqx...")
migrateEmqx()
}
}
@@ -302,11 +303,11 @@ func migrateEmqx() {
err := mq.SendPullSYN()
if err != nil {
slog.Error("failed to send pull syn to clients", "error", err)
logger.Log(0, "failed to send pull syn to clients", "error", err.Error())
slog.Info("proceeding to kicking out clients from emqx")
err := mq.KickOutClients()
if err != nil {
slog.Error("failed to migrate emqx: ", "kickout-error", err)
logger.Log(0, "failed to migrate emqx: ", "kickout-error", err.Error())
}
}
+2
View File
@@ -11,6 +11,7 @@ import (
"time"
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/gravitl/netmaker/logger"
"github.com/gravitl/netmaker/logic"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/servercfg"
@@ -90,6 +91,7 @@ func SendPullSYN() error {
if encryptErr != nil {
continue
}
logger.Log(0, "sending pull syn to", host.Name)
mqclient.Publish(fmt.Sprintf("host/update/%s/%s", hostUpdate.Host.ID.String(), servercfg.GetServer()), 0, true, encrypted)
}
return nil