randomly delay tag subscription processing so it doesn't run all at once

This commit is contained in:
r888888888 2015-01-17 23:29:23 -08:00
parent 11e550c385
commit 7ad7101bc2

View File

@ -173,7 +173,8 @@ class TagSubscription < ActiveRecord::Base
def self.process_all
find_each do |tag_subscription|
if tag_subscription.is_active?
TagSubscription.delay(:queue => "default", :priority => 10).process(tag_subscription.id)
time = rand(4 * 60 * 60).seconds.from_now
TagSubscription.delay(:run_at => time, :queue => "default", :priority => 10).process(tag_subscription.id)
end
end
end