fix error

This commit is contained in:
邱博亞 2022-02-23 13:43:17 +08:00
parent 619ce80267
commit a73850d85d
1 changed files with 2 additions and 3 deletions

View File

@ -36,14 +36,13 @@ class BulletinFeed
else else
Timeout::timeout(timeout) do Timeout::timeout(timeout) do
feed_cache = nil feed_cache = nil
Thread.new do thread = Thread.new do
feed_cache = self.generate_one_cache(startdt: startdt,enddt: enddt,dt: dt,base_url: base_url) feed_cache = self.generate_one_cache(startdt: startdt,enddt: enddt,dt: dt,base_url: base_url)
end end
(1..(timeout.to_i+1)).each do (1..(timeout.to_i+1)).each do
sleep(1) sleep(1)
break if !feed_cache.nil? break if !feed_cache.nil? && !thread.alive?
end end
sleep(0.5)
feed_cache.content feed_cache.content
end end
end end