Sha256: ae3707d18691c02f4f40ba02283278ce6bdd074636b20cb24f22a7b394071a5c
Contents?: true
Size: 864 Bytes
Versions: 6
Compression:
Stored size: 864 Bytes
Contents
# frozen_string_literal: true module Floe class Workflow class Retrier include ErrorMatcherMixin include ValidationMixin attr_reader :error_equals, :interval_seconds, :max_attempts, :backoff_rate, :name def initialize(_workflow, name, payload) @name = name @payload = payload @error_equals = payload["ErrorEquals"] @interval_seconds = payload["IntervalSeconds"] || 1.0 @max_attempts = payload["MaxAttempts"] || 3 @backoff_rate = payload["BackoffRate"] || 2.0 missing_field_error!("ErrorEquals") if !@error_equals.kind_of?(Array) || @error_equals.empty? end # @param [Integer] attempt 1 for the first attempt def sleep_duration(attempt) interval_seconds * (backoff_rate**(attempt - 1)) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems