Skip to content

Commit

Permalink
Looks like delete_multi is broken for the redis backend.
Browse files Browse the repository at this point in the history
We could optimize this in the future by implementing it ourselves
  • Loading branch information
Daverball committed Sep 12, 2024
1 parent e328f31 commit 09d6686
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/onegov/core/orm/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def handle_orm_change(schema: str, obj: 'Base') -> None:
#
# Still, trust but verify:
assert self.schema == schema
self.cache.delete_multi(list(descriptor.used_cache_keys))
for cache_key in descriptor.used_cache_keys:
self.cache.delete(cache_key)
if cache_key in self.request_cache:
del self.request_cache[cache_key]

Expand Down
12 changes: 4 additions & 8 deletions src/onegov/org/views/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,10 @@ def count_page(page: 'Page') -> None:
# a change in the pages tables, which in turn
# will clear these caches. But I suppose it doesn't
# hurt to clear them twice...
request.app.cache.delete_multi([
getattr(request.__class__, prop_name).used_cache_keys
for prop_name in (
'root_pages',
'pages_tree',
'homepage_pages'
)
])
for prop_name in ('root_pages', 'pages_tree', 'homepage_pages'):
prop = getattr(request.__class__, prop_name)
for cache_key in prop.used_cache_keys:
request.app.cache.delete(cache_key)

Check warning on line 274 in src/onegov/org/views/editor.py

View check run for this annotation

Codecov / codecov/patch

src/onegov/org/views/editor.py#L271-L274

Added lines #L271 - L274 were not covered by tests
request.success(_('Your changes were saved'))

@request.after
Expand Down

0 comments on commit 09d6686

Please sign in to comment.