Created
July 26, 2014 20:32
-
-
Save apsheronets/89e55165e70b3013e5e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true | |
needs_update = Feed.needs_update | |
count = needs_update.count | |
if count > 0 | |
puts "#{count} feeds need to be updated" | |
needs_update.each do |feed| | |
begin | |
puts "Feed #{feed.id} is going to be updated" | |
start = Time.now | |
feed.force_update! | |
finish = Time.now | |
time = finish - start | |
puts "Feed #{feed.id} updated in #{time} seconds" | |
rescue => e | |
puts e.message | |
e.backtrace.each{|s|puts s} | |
end | |
end | |
else | |
sleep 30 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment