aboutsummaryrefslogtreecommitdiff
path: root/weed/command/master.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-10-09 18:58:14 -0700
committerchrislu <chris.lu@gmail.com>2022-10-09 18:58:14 -0700
commit1e27d36576afd1d2525e1146b7994cd3d7ef51c5 (patch)
tree81a9ef90764dd4c50d9adafe3d547d12fab0ea6d /weed/command/master.go
parentf9383aa726771b9bd9027cf5e9d62fcaecad9cee (diff)
parentb7de4a967e14f4d7419378e1daf590d3ef8c3c82 (diff)
downloadseaweedfs-1e27d36576afd1d2525e1146b7994cd3d7ef51c5.tar.xz
seaweedfs-1e27d36576afd1d2525e1146b7994cd3d7ef51c5.zip
Merge branch 'master' of https://github.com/seaweedfs/seaweedfs
Diffstat (limited to 'weed/command/master.go')
-rw-r--r--weed/command/master.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/command/master.go b/weed/command/master.go
index f20b2dc62..a74389b1f 100644
--- a/weed/command/master.go
+++ b/weed/command/master.go
@@ -2,6 +2,7 @@ package command
import (
"fmt"
+ hashicorpRaft "github.com/hashicorp/raft"
"net/http"
"os"
"path"
@@ -253,6 +254,13 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {
go httpS.Serve(masterListener)
}
+ grace.OnInterrupt(ms.Shutdown)
+ grace.OnInterrupt(grpcS.GracefulStop)
+ grace.OnReload(func() {
+ if ms.Topo.HashicorpRaft != nil && ms.Topo.HashicorpRaft.State() == hashicorpRaft.Leader {
+ ms.Topo.HashicorpRaft.LeadershipTransfer()
+ }
+ })
select {}
}