Skip to content

Commit

Permalink
Only emit the events when actually deleting the route
Browse files Browse the repository at this point in the history
  • Loading branch information
milosgajdos committed Aug 29, 2019
1 parent f50bd40 commit 4f788c6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions router/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ func (t *table) Delete(r Route) error {
return ErrRouteNotFound
}

delete(t.routes[service], sum)
go t.sendEvent(&Event{Type: Delete, Timestamp: time.Now(), Route: r})
if _, ok := t.routes[service][sum]; ok {
delete(t.routes[service], sum)
go t.sendEvent(&Event{Type: Delete, Timestamp: time.Now(), Route: r})
}

return nil
}
Expand Down

0 comments on commit 4f788c6

Please sign in to comment.