lib/inboxable/polling_receiver_worker.rb in inboxable-0.1.0 vs lib/inboxable/polling_receiver_worker.rb in inboxable-0.1.1

- old
+ new

@@ -7,11 +7,11 @@ def perform Inboxable.configuration.orm == :activerecord ? perform_activerecord : perform_mongoid end def perform_activerecord - Inbox.pending + Inboxable.inbox_model.pending .where(last_attempted_at: [..Time.zone.now, nil]) .find_in_batches(batch_size: ENV.fetch('INBOXABLE__BATCH_SIZE', 100).to_i) .each do |batch| batch.each do |inbox| inbox.processor_class_name.constantize.perform_async(inbox.id) @@ -20,10 +20,10 @@ end end def perform_mongoid batch_size = ENV.fetch('INBOXABLE__BATCH_SIZE', 100).to_i - Inbox.pending + Inboxable.inbox_model.pending .any_of({ last_attempted_at: ..Time.zone.now }, { last_attempted_at: nil }) .each_slice(batch_size) do |batch| batch.each do |inbox| inbox.processor_class_name.constantize.perform_async(inbox.id.to_s) inbox.update(last_attempted_at: 1.minute.from_now, status: :processed, allow_processing: false)