Skip to content

Commit

Permalink
Populate distributed cache from local on first node-update
Browse files Browse the repository at this point in the history
Even if the local node is the only node in the cluster, the node-update
will be for that local node.

Signed-off-by: Madhu Venugopal <madhu@socketplane.io>
  • Loading branch information
mavenugo committed Jan 11, 2015
1 parent 79b9bcf commit 1f1ee13
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ecc.go
Expand Up @@ -58,7 +58,6 @@ func Start(serverMode bool, bootstrap bool, bindInterface string, dataDir string
return errors.New("Error starting Consul Agent")
case <-time.After(time.Second * 5):
}
go populateKVStoreFromCache()
return nil
}

Expand Down Expand Up @@ -337,7 +336,7 @@ func deleteFromCache(storeName string, key string) eccerror {
}

func populateKVStoreFromCache() {
if !OfflineSupport {
if !OfflineSupport || started {
return
}
started = true
Expand Down Expand Up @@ -483,6 +482,11 @@ func updateNodeListeners(clusterNodes []*consulapi.Node) {
listener.NotifyNodeUpdate(NOTIFY_UPDATE_DELETE, deleteNode.Address)
}
}

if len(toAdd) > 0 {
populateKVStoreFromCache()
}

for _, addNode := range toAdd {
for _, listener := range listeners {
listener.NotifyNodeUpdate(NOTIFY_UPDATE_ADD, addNode.Address)
Expand Down

0 comments on commit 1f1ee13

Please sign in to comment.