Commit 2d20892070afba8c59258c1dd73c69d88e556d6c

Authored by Antonio Terceiro
1 parent 762b32cb

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 13 protected
14 14  
15 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 21 end
19 22  
20 23 def expire_cache(profile)
... ...