Only emit event if Update actually happens

This commit is contained in:
Milos Gajdos 2019-08-29 16:21:30 +01:00
parent b457ec1990
commit f50bd400f8
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F

View File

@ -105,8 +105,10 @@ func (t *table) Update(r Route) error {
return nil
}
t.routes[service][sum] = r
go t.sendEvent(&Event{Type: Update, Timestamp: time.Now(), Route: r})
if _, ok := t.routes[service][sum]; !ok {
t.routes[service][sum] = r
go t.sendEvent(&Event{Type: Update, Timestamp: time.Now(), Route: r})
}
return nil
}