fix feed error

This commit is contained in:
chiu committed 2021-08-13 12:42:14 +08:00
1 parent c5f95c9968
commit 234ed6cfea
10 files changed
+232 -172

No files matched your search

+5 -3
View File
@@ -71,9 +71,11 @@ module Announcement
data[key4] = key4_attr
data_item[key_item1] = [value_item1,value_item2,value_item3]
data_item[key_item2] = [value2_item1,value2_item2]
require File.expand_path('../../../app/models/anns_cache', __FILE__)
if defined? AnnsCache
AnnsCache.destroy_all
if ENV['worker_num']=='0' && File.basename($0) != 'rake' && !Rails.const_defined?('Console')
require File.expand_path('../../../app/models/anns_cache', __FILE__)
if defined?(AnnsCache)
AnnsCache.destroy_all
end
end
rescue => e
puts ['error in announcement',e]
+5 -1
View File
@@ -11,7 +11,11 @@ module BulletinModel
elsif self.class == Bulletin || (self.class == Page && self.module == "announcement")
if self.class == Bulletin
tmp_tag_ids = (Array(self.tag_ids) + Array(self.org_tag_ids)).uniq
BulletinFeedCache.where(:uid.in => BulletinFeed.where(:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}).pluck(:uid)).destroy
Thread.new do
BulletinFeedCache.where(:uid.in => BulletinFeed.where(:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}).pluck(:uid)).each do |cache|
cache.regenerate
end
end
end
AnnsCache.all.destroy
end