Browse Source

add config to check for reset peer udpate

abhishek9686 7 tháng trước cách đây
mục cha
commit
557270acdb
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      controllers/hosts.go

+ 6 - 1
controllers/hosts.go

@@ -5,6 +5,7 @@ import (
 	"errors"
 	"fmt"
 	"net/http"
+	"os"
 
 	"github.com/google/uuid"
 	"github.com/gorilla/mux"
@@ -181,7 +182,11 @@ func pull(w http.ResponseWriter, r *http.Request) {
 		}
 	}
 	if sendPeerUpdate {
-		if err := mq.PublishPeerUpdate(true); err != nil {
+		reset := true
+		if os.Getenv("RESET_PEER_UPDATE") != "" {
+			reset = os.Getenv("RESET_PEER_UPDATE") == "true"
+		}
+		if err := mq.PublishPeerUpdate(reset); err != nil {
 			logger.Log(0, "fail to publish peer update: ", err.Error())
 		}
 	}