koding / kite

Micro-service framework in Go
https://godoc.org/github.com/koding/kite
MIT License
3.26k stars 300 forks source link

heartbeat: fix not re-registering when registerHTTP fails #91

Closed fatih closed 9 years ago

fatih commented 9 years ago

Normally registration is forever, until you stop the APP. However if it fails once to send an heartbeat and Kontrol sends a registerAgain, it would try to re-register it. The problem here is, the registration part is done once only. So if something goes wrong and the registration fails, we need to try to register until we are again the loop.

By changing the RegisterHTTP to RegisterHTTPForever, it'll try to register until it's successfull. Once registered, the heartbeat will be starting again.

fatih commented 9 years ago

@cihangir @gokmen I'm merging this. It's a small but important fix for a race condition that can be happen. FYI.