Class: Temporal::RetryPolicy

Inherits:
Struct
  • Object
show all
Defined in:
lib/temporal/retry_policy.rb

Overview

See docs.temporal.io/docs/go/retries/ for go documentation of equivalent concepts.

Defined Under Namespace

Classes: InvalidRetryPolicy

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#backoffObject

Returns the value of attribute backoff

Returns:

  • (Object)

    the current value of backoff



5
6
7
# File 'lib/temporal/retry_policy.rb', line 5

def backoff
  @backoff
end

#intervalObject

Returns the value of attribute interval

Returns:

  • (Object)

    the current value of interval



5
6
7
# File 'lib/temporal/retry_policy.rb', line 5

def interval
  @interval
end

#max_attemptsObject

Returns the value of attribute max_attempts

Returns:

  • (Object)

    the current value of max_attempts



5
6
7
# File 'lib/temporal/retry_policy.rb', line 5

def max_attempts
  @max_attempts
end

#max_intervalObject

Returns the value of attribute max_interval

Returns:

  • (Object)

    the current value of max_interval



5
6
7
# File 'lib/temporal/retry_policy.rb', line 5

def max_interval
  @max_interval
end

#non_retriable_errorsObject

Returns the value of attribute non_retriable_errors

Returns:

  • (Object)

    the current value of non_retriable_errors



5
6
7
# File 'lib/temporal/retry_policy.rb', line 5

def non_retriable_errors
  @non_retriable_errors
end

Instance Method Details

#validate!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/temporal/retry_policy.rb', line 10

def validate!
  unless max_attempts == 1 || (interval && backoff)
    raise InvalidRetryPolicy, 'interval and backoff must be set if max_attempts != 1'
  end

  unless [interval, max_interval].compact.all? { |arg| arg.is_a?(Integer) }
    raise InvalidRetryPolicy, 'All intervals must be specified in whole seconds'
  end

  unless [interval, max_interval].compact.all? { |arg| arg > 0 }
    raise InvalidRetryPolicy, 'All intervals must be greater than 0'
  end
end