Skip to content

Commit

Permalink
codis-ha add maintains switch
Browse files Browse the repository at this point in the history
  • Loading branch information
left2right committed May 30, 2017
1 parent 6694df9 commit 63f906d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/ha/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func main() {
const usage = `
Usage:
codis-ha [--log=FILE] [--log-level=LEVEL] [--interval=SECONDS] --dashboard=ADDR
codis-ha [--log=FILE] [--log-level=LEVEL] [--interval=SECONDS] --dashboard=ADDR [--no-maintains]
codis-ha --version
Options:
Expand Down Expand Up @@ -66,6 +66,11 @@ Options:
log.Warnf("set dashboard = %s", dashboard)
log.Warnf("set interval = %d (seconds)", interval)

var noMaintains = false
if d["--no-maintains"].(bool) {
noMaintains = true
}

client := topom.NewApiClient(dashboard)

t, err := client.Model()
Expand All @@ -86,7 +91,9 @@ Options:
hc := newHealthyChecker(client)
hc.LogProxyStats()
hc.LogGroupStats()
hc.Maintains(client, interval*10, prodcutAuth)
if !noMaintains {
hc.Maintains(client, interval*10, prodcutAuth)
}

time.Sleep(time.Second * time.Duration(interval))
}
Expand Down

0 comments on commit 63f906d

Please sign in to comment.