From d13262589fcac08ebd32cdef8b87b0dcd3e72f1e Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 18 Feb 2016 23:02:28 -0800 Subject: [PATCH] Don't re-register as initializing --- client/client.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/client.go b/client/client.go index fcedae755..17669fb5b 100644 --- a/client/client.go +++ b/client/client.go @@ -393,6 +393,8 @@ func (c *Client) Stats() map[string]map[string]string { // Node returns the locally registered node func (c *Client) Node() *structs.Node { + c.configLock.RLock() + defer c.configLock.RUnlock() return c.config.Node } @@ -758,6 +760,12 @@ func (c *Client) registerNode() error { } return err } + + // Update the node status to ready after we register. + c.configLock.Lock() + node.Status = structs.NodeStatusReady + c.configLock.Unlock() + c.logger.Printf("[DEBUG] client: node registration complete") if len(resp.EvalIDs) != 0 { c.logger.Printf("[DEBUG] client: %d evaluations triggered by node registration", len(resp.EvalIDs))