Skip to content

Commit

Permalink
Merge pull request #983 from bottleneko/fix-cache-on-clear-command
Browse files Browse the repository at this point in the history
Fix cache invalidation on clear command
  • Loading branch information
thomas-mangin committed Jun 2, 2020
2 parents 0dc08ff + 3bc5e23 commit f5c1cc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/exabgp/rib/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def delete_cached_family(self, families):
if family not in families:
del self._seen[family]

def cached_changes(self, families=None):
def cached_changes(self, families=None, actions=[OUT.ANNOUNCE]):
# families can be None or []
requested_families = self.families if families is None else set(families).intersection(self.families)

# we use list() to make a snapshot of the data at the time we run the command
for family in requested_families:
for change in self._seen.get(family, {}).values():
if change.nlri.action == OUT.ANNOUNCE:
if change.nlri.action in actions:
yield change

def is_cached(self, change):
Expand Down
2 changes: 1 addition & 1 deletion lib/exabgp/rib/outgoing.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def withdraw(self, families, enhanced_refresh):
if family not in self._enhanced_refresh_start:
self._enhanced_refresh_start.append(family)

changes = list(self.cached_changes(requested_families))
changes = list(self.cached_changes(requested_families, [OUT.ANNOUNCE,OUT.WITHDRAW]))
for change in changes:
self.del_from_rib(change)

Expand Down

0 comments on commit f5c1cc5

Please sign in to comment.