Created
April 15, 2010 18:25
-
-
Save tsnow/367457 to your computer and use it in GitHub Desktop.
This file contains 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
Delayed::Job.delete_all; | |
{ | |
TradePlan => :work_listing_affinities, | |
SearchPlan => :work_listing_affinities}.each do |klass,method| | |
klass.all.each{|k| k.send_later(method)} | |
end | |
{ Address => [:cycle_location_and_geocode_and_save, 0, true], | |
SearchPlan => [:calc_important_affinities, 2, false]}.each do |klass,method_priority| | |
method = method_priority[0] | |
priority = method_priority[1] | |
later = method_priority[2] | |
count = 0 | |
klass.all.each do |k| | |
count += 1 | |
Delayed::Job.enqueue Delayed::PerformableMethod.new(k,:send,[method]), priority, ( later ? count.minutes.from_now : nil) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment