8c5335f018
We uninstalled Flex, our Elasticsearch gem, to replace item search with direct DB queries; but I forgot these calls, oops! I also kinda want to see about deleting the resque tasks altogether, since I'm not sure how to get Resque installed on latest rails bc there seems to be a conflict over the version of Rack? And it'd be nice to get rid of the complexity if we can.
25 lines
No EOL
598 B
Ruby
25 lines
No EOL
598 B
Ruby
class Item
|
|
class UpdateTask
|
|
extend FragmentExpiration
|
|
|
|
TIMEOUT_IN_SECONDS = 10
|
|
|
|
@queue = :item_update
|
|
|
|
def self.perform(id)
|
|
Timeout::timeout(TIMEOUT_IN_SECONDS) do
|
|
item = Item.find(id)
|
|
expire_cache_for(item)
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def self.expire_cache_for(item)
|
|
expire_fragment_in_all_locales("items/#{item.id}#item_link_partial")
|
|
expire_fragment_in_all_locales("items/#{item.id} header")
|
|
expire_fragment_in_all_locales("items/#{item.id} info")
|
|
expire_key_in_all_locales("items/#{item.id}#as_json")
|
|
end
|
|
end
|
|
end |