would be nice to have such api for grouping events, to minimize sql requests for example
class MyJob < ActiveJob::Base
batch_size 100
def perform(ids)
User.where(:id => ids).update_all "status = 0"
end
end
MyJob.perform_later id1
MyJob.perform_later id2
MyJob.perform_later id3
...
or batch condition:
class MyJob < ActiveJob::Base
batch_by { |id| id / 100 }
def perform(ids)
User.where(:id => ids).update_all "status = 0"
end
end
MyJob.perform_later id1
MyJob.perform_later id2
MyJob.perform_later id3
...
this should be easy to implement, just collect events in memory, and call perform on condition, and if batch raised, just raise all events. If it trap a signal, resend all in memory events.