Class: SpreeCmCommissioner::Integrations::PollingScheduler

Inherits:
Object
  • Object
show all
Defined in:
app/services/spree_cm_commissioner/integrations/polling_scheduler.rb

Constant Summary collapse

BATCH_SIZE =

Process integrations in batches to avoid overwhelming the server

10

Instance Method Summary collapse

Instance Method Details

#callObject



6
7
8
9
10
11
12
13
14
# File 'app/services/spree_cm_commissioner/integrations/polling_scheduler.rb', line 6

def call
  SpreeCmCommissioner::Integration.active.find_each(batch_size: BATCH_SIZE) do |integration|
    if should_run_full_sync?(integration)
      schedule_full_sync(integration)
    elsif should_run_incremental_sync?(integration)
      schedule_incremental_sync(integration)
    end
  end
end