Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cache invalidation on clear command #983

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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