Merge pull request #712 from milosgajdos83/route-update
Only emit table event if table.Update actually happens
This commit is contained in:
commit
690640eeeb
@ -83,8 +83,10 @@ func (t *table) Delete(r Route) error {
|
|||||||
return ErrRouteNotFound
|
return ErrRouteNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(t.routes[service], sum)
|
if _, ok := t.routes[service][sum]; ok {
|
||||||
go t.sendEvent(&Event{Type: Delete, Timestamp: time.Now(), Route: r})
|
delete(t.routes[service], sum)
|
||||||
|
go t.sendEvent(&Event{Type: Delete, Timestamp: time.Now(), Route: r})
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -105,8 +107,10 @@ func (t *table) Update(r Route) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
t.routes[service][sum] = r
|
if _, ok := t.routes[service][sum]; !ok {
|
||||||
go t.sendEvent(&Event{Type: Update, Timestamp: time.Now(), Route: r})
|
t.routes[service][sum] = r
|
||||||
|
go t.sendEvent(&Event{Type: Update, Timestamp: time.Now(), Route: r})
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user