avoid timeout

This commit is contained in:
chiu 2020-07-20 13:07:01 +08:00
parent 2c16e3458f
commit 35153a0020
1 changed files with 7 additions and 3 deletions

View File

@ -21,12 +21,16 @@ module FeedModel
end
def do_before_save
if self.class == Category
SiteFeedAnnc.where(merge_with_category: self.id.to_s).each do |site_feed_annc|
recreate_annc_cache(site_feed_annc)
Thread.new do
SiteFeedAnnc.where(merge_with_category: self.id.to_s).each do |site_feed_annc|
recreate_annc_cache(site_feed_annc)
end
end
elsif self.class == SiteFeed
if self.disabled != true
recreate_annc_cache(self)
Thread.new do
recreate_annc_cache(self)
end
else
tmp = SiteFeedAnnc.where(feed_id: self.id).first
if !tmp.nil?