try to check until success
(cfg *config.ControllerConfig)
| 45 | |
| 46 | // try to check until success |
| 47 | func 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 |
| 66 | func migrateMetadb(cfg *config.ControllerConfig) { |
no test coverage detected