module Temporal::Client::Retryer
Constants
- BACKOFF_COEFFICIENT
- DEFAULT_RETRIES
- INITIAL_INTERVAL_S
- MAX_INTERVAL_S
Public Class Methods
do_not_retry_errors()
click to toggle source
List pulled from RpcRetryOptions in the Java SDK github.com/temporalio/sdk-java/blob/ad8831d4a4d9d257baf3482ab49f1aa681895c0e/temporal-serviceclient/src/main/java/io/temporal/serviceclient/RpcRetryOptions.java#L32 No amount of retrying will help in these cases.
# File lib/temporal/client/retryer.rb, line 12 def self.do_not_retry_errors [ GRPC::AlreadyExists, GRPC::Cancelled, GRPC::FailedPrecondition, GRPC::InvalidArgument, # If the activity has timed out, the server will return this and will never accept a retry GRPC::NotFound, GRPC::PermissionDenied, GRPC::Unauthenticated, GRPC::Unimplemented, ] end
with_retries(times: DEFAULT_RETRIES, on_retry: nil) { || ... }
click to toggle source
Used for backoff retries in certain cases when calling temporal server. on_retry - a proc that's executed each time you need to retry
# File lib/temporal/client/retryer.rb, line 28 def self.with_retries(times: DEFAULT_RETRIES, on_retry: nil, &block) # Values taken from the Java SDK # https://github.com/temporalio/sdk-java/blob/ad8831d4a4d9d257baf3482ab49f1aa681895c0e/temporal-serviceclient/src/main/java/io/temporal/serviceclient/RpcRetryOptions.java#L32 current_interval_s = INITIAL_INTERVAL_S retry_i = 0 loop do begin return yield rescue *do_not_retry_errors raise rescue => e raise e if retry_i >= times retry_i += 1 on_retry.call if on_retry sleep(current_interval_s) current_interval_s = [current_interval_s * BACKOFF_COEFFICIENT, MAX_INTERVAL_S].min end end end