fix error
This commit is contained in:
parent
a73850d85d
commit
35a850b038
|
@ -31,19 +31,18 @@ class BulletinFeed
|
|||
def generate_one_cache_timeout(startdt: nil,enddt: nil,dt: nil, base_url: nil, timeout: nil)
|
||||
begin
|
||||
if timeout.nil?
|
||||
feed_cache = self.generate_one_cache(startdt: startdt,enddt: enddt,dt: dt,base_url: base_url)
|
||||
feed_cache.content
|
||||
feed_cache_content = self.generate_one_cache(startdt: startdt,enddt: enddt,dt: dt,base_url: base_url)
|
||||
else
|
||||
Timeout::timeout(timeout) do
|
||||
feed_cache = nil
|
||||
feed_cache_content = nil
|
||||
thread = Thread.new do
|
||||
feed_cache = self.generate_one_cache(startdt: startdt,enddt: enddt,dt: dt,base_url: base_url)
|
||||
feed_cache_content = self.generate_one_cache(startdt: startdt,enddt: enddt,dt: dt,base_url: base_url)
|
||||
end
|
||||
(1..(timeout.to_i+1)).each do
|
||||
sleep(1)
|
||||
break if !feed_cache.nil? && !thread.alive?
|
||||
break if !feed_cache_content.nil? && !thread.alive?
|
||||
end
|
||||
feed_cache.content
|
||||
feed_cache_content
|
||||
end
|
||||
end
|
||||
rescue=> e
|
||||
|
@ -189,6 +188,7 @@ class BulletinFeed
|
|||
}.to_json
|
||||
BulletinFeedCache.where(uid: uid,start: startdt,end: enddt,date: dt).destroy
|
||||
feed_cache = BulletinFeedCache.create(uid: uid,content: anns,start: startdt,end: enddt,date: dt,invalid_date: invalid_date)
|
||||
feed_cache.content
|
||||
end
|
||||
def self.smart_convertor(text,url)
|
||||
doc = Nokogiri.HTML(text)
|
||||
|
|
Loading…
Reference in New Issue