mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-01-18 22:43:41 +08:00
customizable sleep intervals
This commit is contained in:
parent
50aa769554
commit
e66bddd84c
@ -334,6 +334,7 @@ scripts = """
|
|||||||
ec.balance -force
|
ec.balance -force
|
||||||
volume.balance -force
|
volume.balance -force
|
||||||
"""
|
"""
|
||||||
|
sleep_minutes = 17 # sleep minutes between each script execution
|
||||||
|
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
|
@ -169,6 +169,8 @@ func (ms *MasterServer) proxyToLeader(f func(w http.ResponseWriter, r *http.Requ
|
|||||||
func (ms *MasterServer) startAdminScripts() {
|
func (ms *MasterServer) startAdminScripts() {
|
||||||
v := viper.GetViper()
|
v := viper.GetViper()
|
||||||
adminScripts := v.GetString("master.maintenance.scripts")
|
adminScripts := v.GetString("master.maintenance.scripts")
|
||||||
|
v.SetDefault("master.maintenance.sleep_minutes", 17)
|
||||||
|
sleepMinutes := v.GetInt("master.maintenance.sleep_minutes")
|
||||||
|
|
||||||
glog.V(0).Infof("adminScripts:\n%v", adminScripts)
|
glog.V(0).Infof("adminScripts:\n%v", adminScripts)
|
||||||
if adminScripts == "" {
|
if adminScripts == "" {
|
||||||
@ -195,7 +197,7 @@ func (ms *MasterServer) startAdminScripts() {
|
|||||||
go func() {
|
go func() {
|
||||||
commandEnv.MasterClient.WaitUntilConnected()
|
commandEnv.MasterClient.WaitUntilConnected()
|
||||||
|
|
||||||
c := time.Tick(17 * time.Minute)
|
c := time.Tick(time.Duration(sleepMinutes) * time.Minute)
|
||||||
for _ = range c {
|
for _ = range c {
|
||||||
if ms.Topo.IsLeader() {
|
if ms.Topo.IsLeader() {
|
||||||
for _, line := range scriptLines {
|
for _, line := range scriptLines {
|
||||||
|
Loading…
Reference in New Issue
Block a user