Module: ForemanInventoryUpload::Async::DelayedStart

Extended by:
ActiveSupport::Concern
Included in:
GenerateAllReportsJob, InsightsCloud::Async::InsightsScheduledSync, InventorySync::Async::InventoryScheduledSync
Defined in:
lib/foreman_inventory_upload/async/delayed_start.rb

Constant Summary collapse

START_WINDOW =
3.hours.seconds

Instance Method Summary collapse

Instance Method Details

#after_delay(delay = nil, logger: nil, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/foreman_inventory_upload/async/delayed_start.rb', line 8

def after_delay(delay = nil, logger: nil, &block)
  logger ||= self.logger if respond_to? :logger
  delay ||= ForemanRhCloud.requests_delay || Random.new.rand(START_WINDOW)
  delay = delay.to_i

  logger&.debug("planning a delay for #{delay} seconds before the rest of the execution")

  sequence do
    plan_action(ForemanInventoryUpload::Async::DelayAction, delay)
    concurrence(&block)
  end
end

#humanized_nameObject



21
22
23
# File 'lib/foreman_inventory_upload/async/delayed_start.rb', line 21

def humanized_name
  _('Wait and %s' % super)
end