-
Notifications
You must be signed in to change notification settings - Fork 23
Configurable http_timeout on API requests
#70
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
Merged
Merged
Conversation
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
a315a22 to
5724560
Compare
5724560 to
3b7c4ca
Compare
Contributor
Author
This was referenced Apr 17, 2024
Merged
Merged
91166c4 to
a3dd975
Compare
ea3dfee to
e4579a9
Compare
a3dd975 to
046d486
Compare
e4579a9 to
a3c498e
Compare
046d486 to
8c632a0
Compare
de874c0 to
f27cb15
Compare
This was referenced Feb 24, 2025
Merged
Merged
f27cb15 to
3cc33b1
Compare
3cc33b1 to
9a98116
Compare
Comment on lines
+33
to
+39
| def setup_logging!(logger) | ||
| RestClient.log = Object.new.tap do |proxy| | ||
| def proxy.<<(message) | ||
| logger.info message | ||
| end | ||
| end | ||
| end |
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.
The proxy object's << method is defined with def, which creates a new scope and loses access to the logger variable. To properly capture the logger, use define_singleton_method instead:
RestClient.log = Object.new.tap do |proxy|
proxy.define_singleton_method(:<<) { |message| logger.info message }
endSpotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
jylamont
added a commit
that referenced
this pull request
Feb 25, 2025
#70 introduced a bug that would cause requests to fail because of a misconfigured logger, regardless of whether the gem enabled logging.
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.

This PR adds support for setting a timeout for executing API requests. By default, it will use 60 seconds (which is also the default RestClient uses) but this can be changed by setting
config.http_timeout = xxxto the desired number of seconds. To support this feature, the code calling RestClient had to be fully refactored.Fixes #63