Module: ForemanRhCloud::Async::ExponentialBackoff
- Extended by:
 - ActiveSupport::Concern
 
- Includes:
 - Dynflow::Action::Polling
 
- Included in:
 - ForemanInventoryUpload::Async::ShellProcess, InsightsCloud::Async::InsightsFullSync, InsightsCloud::Async::InsightsResolutionsSync, InsightsCloud::Async::InsightsRulesSync, InventorySync::Async::QueryInventoryJob
 
- Defined in:
 - lib/foreman_rh_cloud/async/exponential_backoff.rb
 
Instance Method Summary collapse
- 
  
    
      #attempts_before_next_interval  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Use each interval once.
 - #done! ⇒ Object
 - #done? ⇒ Boolean
 - #invoke_external_task ⇒ Object
 - #poll_external_task ⇒ Object
 - 
  
    
      #poll_intervals  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
define poll intervals in the following way: [1/10..1, 1..10, 10..100] e.t.c.
 - 
  
    
      #try_execute  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
override this method in the consumng class This is the action that we expect to retry in case of an exception.
 
Instance Method Details
#attempts_before_next_interval ⇒ Object
Use each interval once
      8 9 10  | 
    
      # File 'lib/foreman_rh_cloud/async/exponential_backoff.rb', line 8 def attempts_before_next_interval 1 end  | 
  
#done! ⇒ Object
      21 22 23  | 
    
      # File 'lib/foreman_rh_cloud/async/exponential_backoff.rb', line 21 def done! @done = true end  | 
  
#done? ⇒ Boolean
      25 26 27  | 
    
      # File 'lib/foreman_rh_cloud/async/exponential_backoff.rb', line 25 def done? @done end  | 
  
#invoke_external_task ⇒ Object
      29 30 31 32 33 34  | 
    
      # File 'lib/foreman_rh_cloud/async/exponential_backoff.rb', line 29 def invoke_external_task # Call the polling method from task's framework poll_external_task_with_rescue # supress unexpected task output serialization {} end  | 
  
#poll_external_task ⇒ Object
      36 37 38 39 40  | 
    
      # File 'lib/foreman_rh_cloud/async/exponential_backoff.rb', line 36 def poll_external_task try_execute # supress unexpected task output serialization {} end  | 
  
#poll_intervals ⇒ Object
define poll intervals in the following way: [1/10..1, 1..10, 10..100] e.t.c. total count of intervals would be the amount of poll retries.
      14 15 16 17 18 19  | 
    
      # File 'lib/foreman_rh_cloud/async/exponential_backoff.rb', line 14 def poll_intervals (1..poll_max_retries).map do |i| base = 10**i random_interval(base) end end  | 
  
#try_execute ⇒ Object
override this method in the consumng class This is the action that we expect to retry in case of an exception.
      44 45 46  | 
    
      # File 'lib/foreman_rh_cloud/async/exponential_backoff.rb', line 44 def try_execute raise NotImplementedError end  |