Skip to content

Upgrading retriable 3 to 4

Breaking3.8.0 → 4.2.0Breaking4Platform1New2Changed1Fixed2Other5

BreakingUpgrade verdict

4 breaking changes and a platform requirement change.

  • If you load the optional Kernel helpers, you can still call retriable and retriable_with_context on their own, but not as methods on other objects like "foo".retriable.
  • You can no longer pass a timeout option to these retry methods. Use Ruby's own timeout handling instead.
  • Calling with_context without a block used to silently do nothing and return nil. It now raises an error so the mistake is visible.
  • Contexts configured with an unknown option key now fail with an error on every retriable call, not just the first time that context is used. Non-Hash contexts are still treated as empty options.
Top 4 of 5 that need code or config changes

Ruby requirement changed in 4.0.0: >= 2.3.0 → >= 3.2.

Breaking4
The Kernel extension methods retriable and retriable_with_context are now private, so they can no longer be called with an explicit receiver.
Kernel#retriableKernel#retriable_with_contextretriable/core_ext/kernel
Removes the timeout: option from Retriable.retriable, Retriable.configure, and Retriable.with_override.
Retriable.retriableRetriable.configureRetriable.with_overrideTimeout.timeout()
Retriable.with_context and Kernel#retriable_with_context now raise ArgumentError when called without a block.
Retriable.with_contextKernel#retriable_with_contextRetriable.with_override
Config#validate! now validates the structure of every contexts entry on each retriable or with_context call, raising ArgumentError for unknown option keys.
Config#validate!Retriable.retriableRetriable.with_contextRetriable.with_overridecontexts
Platform1
Raises the minimum Ruby version to 3.2; Ruby 2.x, 3.0, and 3.1 users should stay on the 3.8.x line.

Generated by DepDelta from published Ruby source. Not mixed with prose notes.

  • removed: method Kernel.retriable(_ = …)
  • removed: method Kernel.retriable_with_context(_, _ = …)
  • removed: static method Retriable.call_with_timeout(_, _)
  • removed: static method Retriable.can_retry?(_, _, _, _, _)
  • changed: static method Retriable.execute_tries(max_tries:, interval_for:, timeout:, exception_list:, on:, retry_if:, on_retry:, elapsed_time:, max_elapsed_time:, sleep_disabled:) → static method Retriable.execute_tries(max_tries:, interval_for:, exception_list:, on:, retry_if:, on_retry:, on_give_up:, elapsed_time:, max_elapsed_time:, sleep_disabled:)
  • added: static method Retriable.call_on_give_up(_, _, _, _, _, _)
  • added: static method Retriable.merge_layer(_, _)
  • added: static method Retriable.retry_stop_reason(_, _, _, _, _)
  • removed: static property Config.timeout_deprecation_warned: accessor
  • added: const ExponentialBackoff.DEFAULTS