Browse Source

error check for host update

Abhishek Kondur 2 years ago
parent
commit
e77ab07141
1 changed files with 4 additions and 2 deletions
  1. 4 2
      controllers/hosts.go

+ 4 - 2
controllers/hosts.go

@@ -109,10 +109,12 @@ func updateHost(w http.ResponseWriter, r *http.Request) {
 		}
 	}
 	// publish host update through MQ
-	mq.HostUpdate(&models.HostUpdate{
+	if mq.HostUpdate(&models.HostUpdate{
 		Action: models.UpdateHost,
 		Host:   *newHost,
-	})
+	}); err != nil {
+		logger.Log(0, r.Header.Get("user"), "failed to send host update: ", currHost.ID.String(), err.Error())
+	}
 	go func() {
 		if err := mq.PublishPeerUpdate(); err != nil {
 			logger.Log(0, "fail to publish peer update: ", err.Error())