Configurable http_timeout on API requests - #70
Merged
Merged
Conversation
jylamont
force-pushed
the
feature/rest_client_timeout
branch
2 times, most recently
from
April 17, 2024 23:15
a315a22 to
5724560
Compare
jylamont
changed the base branch from
master
to
04-17-improve_added_github_action_ci
April 17, 2024 23:18
jylamont
force-pushed
the
feature/rest_client_timeout
branch
from
April 17, 2024 23:18
5724560 to
3b7c4ca
Compare
Contributor
Author
This was referenced Apr 17, 2024
Merged
Merged
jylamont
force-pushed
the
feature/rest_client_timeout
branch
2 times, most recently
from
April 17, 2024 23:49
91166c4 to
a3dd975
Compare
jylamont
force-pushed
the
04-17-improve_added_github_action_ci
branch
from
April 18, 2024 00:02
ea3dfee to
e4579a9
Compare
jylamont
force-pushed
the
feature/rest_client_timeout
branch
from
April 18, 2024 00:02
a3dd975 to
046d486
Compare
jylamont
force-pushed
the
04-17-improve_added_github_action_ci
branch
from
April 18, 2024 00:10
e4579a9 to
a3c498e
Compare
jylamont
force-pushed
the
feature/rest_client_timeout
branch
from
April 18, 2024 18:17
046d486 to
8c632a0
Compare
jylamont
force-pushed
the
feature/rest_client_timeout
branch
2 times, most recently
from
February 21, 2025 22:47
de874c0 to
f27cb15
Compare
This was referenced Feb 24, 2025
Merged
Merged
jylamont
force-pushed
the
feature/rest_client_timeout
branch
from
February 24, 2025 15:17
f27cb15 to
3cc33b1
Compare
jylamont
force-pushed
the
feature/rest_client_timeout
branch
from
February 24, 2025 15:23
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.
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.
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.

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