Commit 2d20892070afba8c59258c1dd73c69d88e556d6c
1 parent
762b32cb
Exists in
master
and in
29 other branches
ActionItem1165: being resilient to profile removal.
Don't try to expire cache if either side of the friendship does not exist anymore.
Showing
1 changed file
with
5 additions
and
2 deletions
Show diff stats
app/sweepers/friendship_sweeper.rb
@@ -13,8 +13,11 @@ class FriendshipSweeper < ActiveRecord::Observer | @@ -13,8 +13,11 @@ class FriendshipSweeper < ActiveRecord::Observer | ||
13 | protected | 13 | protected |
14 | 14 | ||
15 | def expire_caches(friendship) | 15 | def expire_caches(friendship) |
16 | - expire_cache(friendship.person) | ||
17 | - expire_cache(friendship.friend) | 16 | + [friendship.person, friendship.friend].each do |profile| |
17 | + if profile | ||
18 | + expire_cache(profile) | ||
19 | + end | ||
20 | + end | ||
18 | end | 21 | end |
19 | 22 | ||
20 | def expire_cache(profile) | 23 | def expire_cache(profile) |