Fix bug.
This commit is contained in:
parent
5bb81c549b
commit
7fe6bbdde2
|
@ -2,9 +2,6 @@ require "rss"
|
||||||
class AnnouncementFeedsController < ApplicationController
|
class AnnouncementFeedsController < ApplicationController
|
||||||
include Admin::AnnouncementsHelper
|
include Admin::AnnouncementsHelper
|
||||||
def feed
|
def feed
|
||||||
Thread.new do
|
|
||||||
BulletinFeedCache.all_of({:invalid_date.ne=>nil,:invalid_date.lte => Time.now}).delete_all
|
|
||||||
end
|
|
||||||
uid = params[:uid]
|
uid = params[:uid]
|
||||||
startdt = params[:start].blank? ? nil : params[:start]
|
startdt = params[:start].blank? ? nil : params[:start]
|
||||||
enddt = params[:end].blank? ? nil : params[:end]
|
enddt = params[:end].blank? ? nil : params[:end]
|
||||||
|
|
|
@ -10,9 +10,14 @@ class BulletinFeedCache
|
||||||
field :invalid_date, type: DateTime
|
field :invalid_date, type: DateTime
|
||||||
def self.regenerate_all
|
def self.regenerate_all
|
||||||
caches = self.all.to_a
|
caches = self.all.to_a
|
||||||
caches.each do |cache|
|
time_now = Time.now
|
||||||
cache.regenerate
|
caches.each do |cache|
|
||||||
end
|
if cache.invalid_date && cache.invalid_date <= time_now
|
||||||
|
cache.destroy
|
||||||
|
else
|
||||||
|
cache.regenerate
|
||||||
|
end
|
||||||
|
end
|
||||||
uids = BulletinFeed.all.pluck(:uid) - caches.collect(&:uid)
|
uids = BulletinFeed.all.pluck(:uid) - caches.collect(&:uid)
|
||||||
BulletinFeed.where(:uid.in=> uids).each do |feed|
|
BulletinFeed.where(:uid.in=> uids).each do |feed|
|
||||||
feed.generate_one_cache()
|
feed.generate_one_cache()
|
||||||
|
|
Loading…
Reference in New Issue