Class: RailsTransactionalOutbox::RunnerSleepInterval

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_transactional_outbox/runner_sleep_interval.rb

Class Method Summary collapse

Class Method Details

.interval_for(processed_entries, sleep_seconds, idle_delay_multiplier) ⇒ Object

TODO: maybe apply some backoff or longer pause if there were no entries to be processed?



6
7
8
9
10
11
12
# File 'lib/rails_transactional_outbox/runner_sleep_interval.rb', line 6

def self.interval_for(processed_entries, sleep_seconds, idle_delay_multiplier)
  if processed_entries.any?
    sleep_seconds
  else
    sleep_seconds * idle_delay_multiplier
  end
end