From c9d1acd4b7c0993b9a665e22489949ac227a2717 Mon Sep 17 00:00:00 2001
From: sunty <1172534965@qq.com>
Date: 星期一, 13 四月 2020 17:04:49 +0800
Subject: [PATCH] add volume to master server

---
 controllers/swfsControllers.go |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/controllers/swfsControllers.go b/controllers/swfsControllers.go
index 18d0eb9..95d1a8c 100644
--- a/controllers/swfsControllers.go
+++ b/controllers/swfsControllers.go
@@ -30,7 +30,6 @@
 	oldPeers := GetOldPeers(config.Server.ScriptPath, StartServerScript)
 	newPeers := GetNewPeers()
 	UpdatePeers(config.Server.ScriptPath, StartServerScript, oldPeers, newPeers)
-	ReplaceLineContentBySearch(StartScriptAsVolume, config.Server.ScriptPath, StartServerScript)
 }
 
 // @Security ApiKeyAuth
@@ -48,7 +47,6 @@
 	c.BindJSON(&body)
 	role := body.Role
 	if role == "master" {
-		AddNewMasterToPeers()
 		AsMaster()
 		util.ResponseFormat(c, code.AddSuccess, "鍔犲叆鑺傜偣鎴愬姛")
 		return
@@ -70,6 +68,7 @@
 
 func (sc *SeaweedfsController) RoleOfVolumeToMasterController(c *gin.Context) {
 	AsMaster()
+	ReplaceLineContentBySearch(StartScriptAsMaster, config.Server.ScriptPath, StartServerScript)
 }
 
 func (sc *SeaweedfsController) RestartMasterController(c *gin.Context) {
@@ -189,6 +188,7 @@
 
 //浣滀负涓昏妭鐐瑰姞鍏ワ紙榛樿鍖呭惈鏁版嵁鑺傜偣锛�
 func AsMaster() bool {
+	AddNewMasterToPeers()
 	nowPeers := GetNowPeersList()
 	RequestMasterNodesOperation(nowPeers)
 	return true

--
Gitblit v1.8.0