Class: Temporalio::RetryPolicy

Inherits:
Data
  • Object
show all
Defined in:
lib/temporalio/retry_policy.rb,
lib/temporalio/retry_policy.rb

Overview

Options for retrying workflows and activities.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(initial_interval: 1.0, backoff_coefficient: 2.0, max_interval: nil, max_attempts: 0, non_retryable_error_types: nil) ⇒ RetryPolicy

Create retry policy.

Parameters:

  • initial_interval (Float) (defaults to: 1.0)

    Backoff interval in seconds for the first retry. Default 1.0.

  • backoff_coefficient (Float) (defaults to: 2.0)

    Coefficient to multiply previous backoff interval by to get new interval. Default 2.0.

  • max_interval (Float, nil) (defaults to: nil)

    Maximum backoff interval in seconds between retries. Default 100x ‘initial_interval`.

  • max_attempts (Integer) (defaults to: 0)

    Maximum number of attempts. If ‘0`, the default, there is no maximum.

  • non_retryable_error_types (Array<String>, nil) (defaults to: nil)

    List of error types that are not retryable.



47
48
49
50
51
52
53
54
55
# File 'lib/temporalio/retry_policy.rb', line 47

def initialize(
  initial_interval: 1.0,
  backoff_coefficient: 2.0,
  max_interval: nil,
  max_attempts: 0,
  non_retryable_error_types: nil
)
  super
end

Instance Attribute Details

#backoff_coefficientFloat

Returns Coefficient to multiply previous backoff interval by to get new interval. Default 2.0.

Returns:

  • (Float)

    Coefficient to multiply previous backoff interval by to get new interval. Default 2.0.



26
27
28
# File 'lib/temporalio/retry_policy.rb', line 26

def backoff_coefficient
  @backoff_coefficient
end

#initial_intervalFloat

Returns Backoff interval in seconds for the first retry. Default 1.0.

Returns:

  • (Float)

    Backoff interval in seconds for the first retry. Default 1.0.



26
27
28
# File 'lib/temporalio/retry_policy.rb', line 26

def initial_interval
  @initial_interval
end

#max_attemptsInteger

Returns Maximum number of attempts. If ‘0`, the default, there is no maximum.

Returns:

  • (Integer)

    Maximum number of attempts. If ‘0`, the default, there is no maximum.



26
27
28
# File 'lib/temporalio/retry_policy.rb', line 26

def max_attempts
  @max_attempts
end

#max_intervalFloat?

Returns Maximum backoff interval in seconds between retries. Default 100x ‘initial_interval`.

Returns:

  • (Float, nil)

    Maximum backoff interval in seconds between retries. Default 100x ‘initial_interval`.



26
27
28
# File 'lib/temporalio/retry_policy.rb', line 26

def max_interval
  @max_interval
end

#non_retryable_error_typesArray<String>?

Returns List of error types that are not retryable.

Returns:

  • (Array<String>, nil)

    List of error types that are not retryable.



26
27
28
# File 'lib/temporalio/retry_policy.rb', line 26

def non_retryable_error_types
  @non_retryable_error_types
end