From f50bd400f89f7c62bfe82028a2c2ec4dcbc13598 Mon Sep 17 00:00:00 2001 From: Milos Gajdos Date: Thu, 29 Aug 2019 16:21:30 +0100 Subject: [PATCH] Only emit event if Update actually happens --- router/table.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/router/table.go b/router/table.go index 42a1be47..c35f9a89 100644 --- a/router/table.go +++ b/router/table.go @@ -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 }