class OCI::Retry::Internal::RetryState
A property bag containing the current state of making a retriable call
Attributes
current_attempt_number[R]
The current number of attempts which have been made. This is one-based (i.e. the first attempt is 1, the second is 2 etc.)
last_exception[RW]
The last exception which was raised when making a retriable call
@return [Exception]
start_time_epoch_millis[R]
When we started making retriable calls, in epoch milliseconds
@return [Integer]
Public Class Methods
new()
click to toggle source
# File lib/oci/retry/internal/retry_state.rb, line 25 def initialize @current_attempt_number = 0 end
Public Instance Methods
increment_attempts()
click to toggle source
Increments the number of attempts which have been made by 1
# File lib/oci/retry/internal/retry_state.rb, line 30 def increment_attempts @current_attempt_number += 1 end
start()
click to toggle source
Sets the {#start_time_epoch_millis} property to the current time in epoch milliseconds. This can only be done once.
# File lib/oci/retry/internal/retry_state.rb, line 36 def start raise 'The start_time for the retry state has already been set' unless @start_time_epoch_millis.nil? @start_time_epoch_millis = (Time.now.to_f * 1000).to_i end
to_s()
click to toggle source
# File lib/oci/retry/internal/retry_state.rb, line 42 def to_s "{ 'current_attempt': '#{current_attempt_number}', " \ "'start_time_epoch_millis': '#{start_time_epoch_millis}', " \ "'last_exception': '#{last_exception}' }" end