Skip to content

Instantly share code, notes, and snippets.

@apsheronets
Created July 26, 2014 20:32
Show Gist options
  • Save apsheronets/89e55165e70b3013e5e2 to your computer and use it in GitHub Desktop.
Save apsheronets/89e55165e70b3013e5e2 to your computer and use it in GitHub Desktop.
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