Created
April 24, 2014 14:30
-
-
Save julesce/11256680 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
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