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 end
def do_before_save def do_before_save
if self.class == Category if self.class == Category
Thread.new do
SiteFeedAnnc.where(merge_with_category: self.id.to_s).each do |site_feed_annc| SiteFeedAnnc.where(merge_with_category: self.id.to_s).each do |site_feed_annc|
recreate_annc_cache(site_feed_annc) recreate_annc_cache(site_feed_annc)
end end
end
elsif self.class == SiteFeed elsif self.class == SiteFeed
if self.disabled != true if self.disabled != true
Thread.new do
recreate_annc_cache(self) recreate_annc_cache(self)
end
else else
tmp = SiteFeedAnnc.where(feed_id: self.id).first tmp = SiteFeedAnnc.where(feed_id: self.id).first
if !tmp.nil? if !tmp.nil?