|
|
@ -52,7 +52,7 @@ func NewService(c Client, s Store) *Service {
|
|
|
|
s: s,
|
|
|
|
s: s,
|
|
|
|
|
|
|
|
|
|
|
|
RegisterInterval: 3 * time.Second,
|
|
|
|
RegisterInterval: 3 * time.Second,
|
|
|
|
ReportInterval: 30 * time.Second,
|
|
|
|
ReportInterval: 10 * time.Second,
|
|
|
|
logger: log.New(os.Stderr, "[disco] ", log.LstdFlags),
|
|
|
|
logger: log.New(os.Stderr, "[disco] ", log.LstdFlags),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -89,7 +89,7 @@ func (s *Service) Register(id, apiAddr, addr string) (bool, string, error) {
|
|
|
|
// to deal with any intermittent issues that caused Leadership information
|
|
|
|
// to deal with any intermittent issues that caused Leadership information
|
|
|
|
// to go stale.
|
|
|
|
// to go stale.
|
|
|
|
func (s *Service) StartReporting(id, apiAddr, addr string) chan struct{} {
|
|
|
|
func (s *Service) StartReporting(id, apiAddr, addr string) chan struct{} {
|
|
|
|
ticker := time.NewTicker(10 * s.ReportInterval)
|
|
|
|
ticker := time.NewTicker(s.ReportInterval)
|
|
|
|
obCh := make(chan struct{}, leaderChanLen)
|
|
|
|
obCh := make(chan struct{}, leaderChanLen)
|
|
|
|
s.s.RegisterLeaderChange(obCh)
|
|
|
|
s.s.RegisterLeaderChange(obCh)
|
|
|
|
|
|
|
|
|
|
|
|