Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add retryable #1

Merged
merged 4 commits into from
Nov 16, 2020
Merged

Add retryable #1

merged 4 commits into from
Nov 16, 2020

Conversation

ybiquitous
Copy link
Contributor

@ybiquitous ybiquitous commented Nov 13, 2020

NOTE: This change updates Gemfile and Gemfile.lock because the branches repo and update-rbs do not exist already in ruby/rbs and soutaro/steep.
=> Merged the latest Gemfile* files from the main branch.

@ybiquitous ybiquitous marked this pull request as ready for review November 13, 2020 10:35
Gemfile Outdated Show resolved Hide resolved
@soutaro
Copy link
Member

soutaro commented Nov 13, 2020

@ybiquitous I recommend adding some tests from examples in README.md of the gem.

puts "foo"
end

Retryable.retryable(tries: 3, on: ArgumentError) do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry for my laziness... 😓
When I've added a test case, but the following error occurs:

$ bundle exec steep check
test.rb:7:20: ArgumentTypeMismatch: receiver=singleton(::Retryable), expected=::Retryable::Configuration::options, actual=::Hash[::Symbol, (::Integer | singleton(::ArgumentError))] (tries: 3, on: ArgumentError)

Can you provide any solutions to fix the error, please? The following locations are related to the error:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steep 0.17.0 would help. soutaro/steep#256

It allows omitting nil-able attributes, so defining options as the following can be an option.

    type options = {
      contexts: Hash[Symbol, options]?,
      ensure: ^(Integer) -> void | nil,
      exception_cb: ^(Exception) -> void | nil,
      log_method: ^(Integer, Exception) -> void | nil,
      matching: (String | Regexp) | Array[String | Regexp] | nil,
      not: _Exception | Array[_Exception] | nil,
      on: _Exception | Array[_Exception] | nil,
      sleep: real | (^(real) -> void) | nil,
      sleep_method: ^(real) -> void | nil,
      tries: Integer | nil
    }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2 🙇

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I've updated Gemfile* files to the latest version and fixed the test!

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@soutaro soutaro merged commit ddf76cb into ruby:main Nov 16, 2020
@ybiquitous ybiquitous deleted the retryable branch November 16, 2020 03:36
@ybiquitous
Copy link
Contributor Author

@soutaro Thank you so much for your help! 😊

ybiquitous added a commit that referenced this pull request Jun 8, 2023
I previously updated the Rainbow gem and added the Parallel gem.
- #1
- #6
- #21
ybiquitous added a commit that referenced this pull request Jun 8, 2023
I previously updated the Rainbow gem and added the Parallel/Retryable gems.
- #1
- #6
- #21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants