Skip to content

Instantly share code, notes, and snippets.

@julesce
Created April 24, 2014 14:30
Show Gist options
  • Save julesce/11256680 to your computer and use it in GitHub Desktop.
Save julesce/11256680 to your computer and use it in GitHub Desktop.
Promotion.find_each(:batch_size => 10) do |p|
if p.refreshing_stats?
date_refresh_started_at = p.retrieve_stats_cache_info(:refreshing => false)
if date_refresh_started_at
threshold_time = 6.hours.ago
if date_refresh_started_at < threshold_time
p.done_refreshing_stats
puts "Forced the completion of stats refresh for promotion #{p.id}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment