-
Notifications
You must be signed in to change notification settings - Fork 106
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
Conversation
@ybiquitous I recommend adding some tests from examples in README.md of the gem. |
gems/retryable/3.0/_test/test.rb
Outdated
puts "foo" | ||
end | ||
|
||
Retryable.retryable(tries: 3, on: ArgumentError) do |
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
つ #2 🙇
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
@soutaro Thank you so much for your help! 😊 |
NOTE: This change updatesGemfile
andGemfile.lock
because the branchesrepo
andupdate-rbs
do not exist already inruby/rbs
andsoutaro/steep
.=> Merged the latest
Gemfile*
files from themain
branch.