MCPcopy Create free account
hub / github.com/deepflowio/deepflow / IsMasterController

Function IsMasterController

server/controller/controller/master.go:47–63  ·  view source on GitHub ↗

try to check until success

(cfg *config.ControllerConfig)

Source from the content-addressed store, hash-verified

45
46// try to check until success
47func IsMasterController(cfg *config.ControllerConfig) bool {
48 if IsMasterRegion(cfg) {
49 for range time.Tick(time.Second * 5) {
50 isMasterController, err := election.IsMasterController()
51 if err == nil {
52 if isMasterController {
53 return true
54 } else {
55 return false
56 }
57 } else {
58 log.Errorf("check whether I am master controller failed: %s", err.Error())
59 }
60 }
61 }
62 return false
63}
64
65// migrate db by master region master controller
66func migrateMetadb(cfg *config.ControllerConfig) {

Callers 1

StartFunction · 0.70

Calls 3

IsMasterRegionFunction · 0.85
ErrorMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected