mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
client: avoid registering node twice right away
I noticed that `watchNodeUpdates()` almost immediately after `registerAndHeartbeat()` calls `retryRegisterNode()`, well after 5 seconds. This call is unnecessary and made debugging a bit harder. So here, we ensure that we only re-register node for new node events, not for initial registration.
This commit is contained in:
@@ -1468,13 +1468,7 @@ func (c *Client) watchNodeEvents() {
|
||||
// batchEvents stores events that have yet to be published
|
||||
var batchEvents []*structs.NodeEvent
|
||||
|
||||
// Create and drain the timer
|
||||
timer := time.NewTimer(0)
|
||||
timer.Stop()
|
||||
select {
|
||||
case <-timer.C:
|
||||
default:
|
||||
}
|
||||
timer := stoppedTimer()
|
||||
defer timer.Stop()
|
||||
|
||||
for {
|
||||
@@ -1930,7 +1924,8 @@ func (c *Client) updateNodeLocked() {
|
||||
// it will update the client node copy and re-register the node.
|
||||
func (c *Client) watchNodeUpdates() {
|
||||
var hasChanged bool
|
||||
timer := time.NewTimer(c.retryIntv(nodeUpdateRetryIntv))
|
||||
|
||||
timer := stoppedTimer()
|
||||
defer timer.Stop()
|
||||
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user