mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
throw a short temp cache around excluded_actioning_site_ids
This commit is contained in:
parent
9d9ada3acc
commit
07be2dcecc
1 changed files with 6 additions and 1 deletions
|
@ -17,7 +17,12 @@ class Event < Sequel::Model
|
||||||
GLOBAL_VIEWS_SITE_CHANGE_MINIMUM = 1000
|
GLOBAL_VIEWS_SITE_CHANGE_MINIMUM = 1000
|
||||||
|
|
||||||
def self.news_feed_default_dataset
|
def self.news_feed_default_dataset
|
||||||
excluded_actioning_site_ids = DB[%{select distinct(actioning_site_id) from events join sites on actioning_site_id=sites.id where sites.is_banned='t' or sites.is_nsfw='t' or sites.is_deleted='t'}].all.collect {|r| r[:actioning_site_id]}
|
if SimpleCache.expired?(:excluded_actioning_site_ids)
|
||||||
|
res = DB[%{select distinct(actioning_site_id) from events join sites on actioning_site_id=sites.id where sites.is_banned='t' or sites.is_nsfw='t' or sites.is_deleted='t'}].all.collect {|r| r[:actioning_site_id]}
|
||||||
|
excluded_actioning_site_ids = SimpleCache.store :excluded_actioning_site_ids, res, 10.minutes
|
||||||
|
else
|
||||||
|
excluded_actioning_site_ids = SimpleCache.get :excluded_actioning_site_ids
|
||||||
|
end
|
||||||
|
|
||||||
ds = select_all(:events).
|
ds = select_all(:events).
|
||||||
order(:created_at.desc).
|
order(:created_at.desc).
|
||||||
|
|
Loading…
Add table
Reference in a new issue