Forget a runtime's old instance once it answers under a new one, so a restart is not reported as a missed answer
This commit is contained in:
@@ -81,6 +81,17 @@ func (s *Surface) remember(x *index) {
|
||||
heard[k] = true
|
||||
s.runtimes[k] = seen
|
||||
}
|
||||
// A runtime restarted answers under a new instance id: the old one is gone, not silent, and saying
|
||||
// it was missed would hide nothing but cry wolf after every restart.
|
||||
now := map[string]bool{}
|
||||
for k := range heard {
|
||||
now[s.runtimes[k].Name+"@"+s.runtimes[k].Machine] = true
|
||||
}
|
||||
for k, r := range s.runtimes {
|
||||
if !heard[k] && r.Machine != "" && now[r.Name+"@"+r.Machine] {
|
||||
delete(s.runtimes, k)
|
||||
}
|
||||
}
|
||||
silent := map[string]string{}
|
||||
for _, u := range x.Discovery.Silent {
|
||||
silent[runtimeKey(u.Name, u.ID)] = fmt.Sprintf("it answered PING; what it serves did not arrive within %s", announce.Patience)
|
||||
|
||||
Reference in New Issue
Block a user