Remove unused "outfits#new newest_items" cache
Huh! This cache key seemed to only be referenced in checks and expirations, but was never actually used! So I guess we've been loading the modeling predictions every time for a while huh?? We'll get smarter about that someday, but anyway, that lets us delete our Item resque tasks and ItemObserver!
This commit is contained in:
parent
e9c16891c8
commit
596c2a1320
5 changed files with 19 additions and 66 deletions
|
@ -46,7 +46,6 @@ class OutfitsController < ApplicationController
|
||||||
@species = Species.alphabetical
|
@species = Species.alphabetical
|
||||||
end
|
end
|
||||||
|
|
||||||
unless localized_fragment_exist?('outfits#new newest_items')
|
|
||||||
newest_items = Item.newest.select([:id, :updated_at, :thumbnail_url, :rarity_index]).
|
newest_items = Item.newest.select([:id, :updated_at, :thumbnail_url, :rarity_index]).
|
||||||
includes(:translations).limit(18)
|
includes(:translations).limit(18)
|
||||||
@newest_modeled_items, @newest_unmodeled_items =
|
@newest_modeled_items, @newest_unmodeled_items =
|
||||||
|
@ -69,7 +68,6 @@ class OutfitsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
@species_count = Species.count
|
@species_count = Species.count
|
||||||
end
|
|
||||||
|
|
||||||
unless localized_fragment_exist?('outfits#new latest_contribution')
|
unless localized_fragment_exist?('outfits#new latest_contribution')
|
||||||
@latest_contribution = Contribution.recent.first
|
@latest_contribution = Contribution.recent.first
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
class Item
|
|
||||||
class CreateTask
|
|
||||||
extend FragmentExpiration
|
|
||||||
|
|
||||||
TIMEOUT_IN_SECONDS = 10
|
|
||||||
|
|
||||||
@queue = :item_create
|
|
||||||
|
|
||||||
def self.perform(id)
|
|
||||||
Timeout::timeout(TIMEOUT_IN_SECONDS) do
|
|
||||||
expire_newest_items
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.expire_newest_items
|
|
||||||
expire_fragment_in_all_locales('outfits#new newest_items')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,16 +0,0 @@
|
||||||
class Item
|
|
||||||
class DestroyTask
|
|
||||||
extend FragmentExpiration
|
|
||||||
|
|
||||||
TIMEOUT_IN_SECONDS = 10
|
|
||||||
|
|
||||||
@queue = :item_destroy
|
|
||||||
|
|
||||||
def self.perform(id)
|
|
||||||
Timeout::timeout(TIMEOUT_IN_SECONDS) do
|
|
||||||
# TODO: it's kinda ugly to reach across classes like this
|
|
||||||
CreateTask.expire_newest_items
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,9 +0,0 @@
|
||||||
class ItemObserver < ActionController::Caching::Sweeper
|
|
||||||
def after_create(item)
|
|
||||||
Resque.enqueue(Item::CreateTask, item.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def after_destroy(item)
|
|
||||||
Resque.enqueue(Item::DestroyTask, item.id)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -100,7 +100,6 @@
|
||||||
%abbr#latest-contribution-created-at{:title => @latest_contribution.created_at.getutc.iso8601}
|
%abbr#latest-contribution-created-at{:title => @latest_contribution.created_at.getutc.iso8601}
|
||||||
|
|
||||||
#whats-new
|
#whats-new
|
||||||
-# TODO: cache this entire block? or just request newest items every time?
|
|
||||||
- if @newest_unmodeled_items.present?
|
- if @newest_unmodeled_items.present?
|
||||||
#modeling-neopets-users{'data-usernames' => @neopets_usernames.to_json}
|
#modeling-neopets-users{'data-usernames' => @neopets_usernames.to_json}
|
||||||
%h3= t '.newest_items.unmodeled.header'
|
%h3= t '.newest_items.unmodeled.header'
|
||||||
|
|
Loading…
Reference in a new issue