mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
Clear the backup server list when a Nomad heartbeat arives with servers
If Nomad is heartbeating during a transition from using backup servers to Nomad servers, make Nomad the canonical source of servers and flush the list of servers populated from Consul.
This commit is contained in:
@@ -642,6 +642,12 @@ func (p *RpcProxy) UpdateFromNodeUpdateResponse(resp *structs.NodeUpdateResponse
|
||||
p.serverListLock.Lock()
|
||||
defer p.serverListLock.Unlock()
|
||||
|
||||
// Clear the backup server list when a heartbeat contains at least
|
||||
// one server.
|
||||
if len(resp.Servers) > 0 && len(p.backupServers.L) > 0 {
|
||||
p.backupServers.L = make([]*ServerEndpoint, len(resp.Servers))
|
||||
}
|
||||
|
||||
// 1) Create a map to reconcile the difference between
|
||||
// m.primaryServers and resp.Servers.
|
||||
type targetServer struct {
|
||||
|
||||
Reference in New Issue
Block a user