Skip to content

[BUG]: The type of the dependency on faraday-retry is irritating and unclear. #1567

Open
@expeehaa

Description

What happened?

When using the gem with faraday > 2 without having faraday-retry installed, octokit.rb always prints this warning message.

To use retry middleware with Faraday v2.0+, install `faraday-retry` gem

According to #1486, there are currently 2 ways to disable the warning:

  • disable all warnings by setting OCTOKIT_SILENT=true
  • install faraday-retry

The first option has the side effect of disabling any warning from octokit.rb, which is clearly not my intention. The second option requires me to install a gem, but this appears to actually be kind of optional. I had no issues yet without faraday-retry and usages test if its constants are defined:

if defined?(Faraday::Request::Retry)
retry_exceptions = Faraday::Request::Retry::DEFAULT_EXCEPTIONS + [Octokit::ServerError]
builder.use Faraday::Request::Retry, exceptions: retry_exceptions
elsif defined?(Faraday::Retry::Middleware)
retry_exceptions = Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Octokit::ServerError]
builder.use Faraday::Retry::Middleware, exceptions: retry_exceptions
end

In case I do not want to use faraday-retry for whatever reason, I will therefore always be left with that annoying warning.

From this perspective, it is not clear what kind of dependency octokit.rb actually has on faraday-retry. It is not required, cannot be listed in the gemspec since faraday ~> 1.0 is also supported, but also is not fully optional since the exclusion affects all programs using octokit.rb by printing a warning.

If it is optional, I would expect to at most get a post-install message of the warning (probably rather a README entry), but not a forced warning. If it is required, I would expect require 'octokit.rb' to raise the warning message as an error when require 'faraday/retry' raises a LoadError.

Implementing either of those options seems quite trivial, contrary to what was claimed in #1486 in this comment. Did I miss something there?

I’ld happily create a PR, although I have no idea which options would be preferred, if any.

Versions

octokit.rb = 6.1.1, faraday = 2.7.4 without faraday-retry

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Assignees

No one assigned

    Labels

    Status: Up for grabsIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documentedhacktoberfestIssues for participation in Hacktoberfest

    Type

    No type

    Projects

    • Status

      🔥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions