Deprecate timeout option for 3.8.0#135
Merged
Merged
Conversation
Reroute the timeout: deprecation through a Gem::Deprecate-style
once-per-process gate. The previous helper checked Warning[:deprecated]
and fell back to a plain Kernel.warn when deprecation warnings were
disabled, which inverted user intent (silencing the standard channel
caused us to emit anyway).
- Config tracks emission state class-side and short-circuits on
Gem::Deprecate.skip, so Gem::Deprecate.skip_during { ... } silences
the warning for callers and tests.
- Kernel.warn is called without category: :deprecated because
Warning[:deprecated] defaults to false in Ruby 3.x and would hide
the notice from end users; Gem::Deprecate itself plain-warns for
the same reason.
- Retriable.retriable validates the local config unconditionally
again now that double-validation no longer double-warns; the
previous dedup branch is removed and the comment is no longer
misleading.
- Spec helper resets the flag before each example; new specs cover
once-per-process behavior, Gem::Deprecate.skip_during silencing,
and re-arming after a skipped block.
- README/CHANGELOG document once-per-process emission, the
skip_during escape hatch, and that wrapping the retried block in
Timeout.timeout(5) preserves per-try semantics (use
max_elapsed_time: for an overall cap).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Switch the timeout: deprecation notice from a plain Kernel.warn to Kernel.warn(..., category: :deprecated) on Rubies that support the keyword (2.7+), and drop the bespoke Gem::Deprecate.skip escape hatch. This restores the standard Ruby deprecation controls: * Warning[:deprecated] = false silences the warning. * ruby -W:no-deprecated silences the warning. * Overriding Warning.warn lets callers filter it. Older Rubies (2.3-2.6) that lack the category kwarg keep the previous plain Kernel.warn behavior. The once-per-process gate is preserved, but it now only fires when the warning is actually emitted. If the category is muted, the warner stays armed, so a later call with deprecation warnings re-enabled still surfaces the notice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
timeout:usage while preserving existing 3.x runtime behavior. Related: Timeout::timeout is inherently unsafe #96Config,Retriable.retriable,with_override, and configured timeout warnings, including avoiding duplicate warnings.timeout:.Test Plan
bundle exec rspec(139 examples, 0 failures)bundle exec rubocop(same 5 pre-existing gemspec offenses as baseline; no new offenses)bundle exec ruby -Ilib -r retriable -e 'Retriable.retriable(timeout: 1) { :ok }'bundle exec ruby -Ilib -r retriable -e 'Retriable.retriable { :ok }'gem build retriable.gemspec && rm retriable-3.8.0.gem