Codebase list golang-github-docker-leadership / 1ea8557
Fix leadership doc example typo Signed-off-by: Aaron Chen <aaron.chen@curiositychina.com> Aaron Chen 8 years ago
1 changed file(s) with 2 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
1414 panic(err)
1515 }
1616
17 underwood := leadership.NewCandidate(client, "service/swarm/leader", "underwood")
17 underwood := leadership.NewCandidate(client, "service/swarm/leader", "underwood", 15*time.Second)
1818 electedCh, _, err := underwood.RunForElection()
1919 if err != nil {
2020 log.Fatal("Cannot run for election, store is probably down")
5252 if err != nil {
5353 log.Fatal("Cannot follow the election, store is probably down")
5454 }
55 for leader := <-leaderCh {
55 for leader := range leaderCh {
5656 // Leader is a string containing the value passed to `NewCandidate`.
5757 log.Printf("%s is now the leader", leader)
5858 }