Example #1
0
// registrationLoop registers the current node against the discovery backend using the specified
// address. The function never returns, as registration against the backend comes with a TTL and
// requires regular heartbeats.
func registrationLoop(discoveryBackend discovery.Backend, address string) {
	for {
		if err := discoveryBackend.Register(address); err != nil {
			log.Errorf("Registering as %q in discovery failed: %v", address, err)
		}
		time.Sleep(defaultDiscoveryHeartbeat)
	}
}
Example #2
0
func registerAddr(backend discovery.Backend, addr string) {
	if err := backend.Register(addr); err != nil {
		log.Warnf("Registering as %q in discovery failed: %v", addr, err)
	}
}