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