-
Notifications
You must be signed in to change notification settings - Fork 27
Adds CONNECT_REQUEST_TIMEOUT env variable #349
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
Conversation
49b4728 to
54bb90b
Compare
|
@mmarchetti and @bcwu - I've kept this pull request as a draft, but I would appreciate your initial thoughts on this approach. I have outlined my decision-making process in the pull request description. In particular, is not adding CLI support viable? And is a single global timeout option appropriate? Are there situations where multiple timeouts are needed for a single command? Also, in case you missed it, here is a relevant discussion from Slack: https://positpbc.slack.com/archives/C021090K8Q5/p1675785843875829 |
54bb90b to
445676b
Compare
8254bc0 to
2d34536
Compare
Adds support for configurable HTTP and HTTPS timeouts via the environment variable "CONNECT_REQUEST_TIMEOUT". When not set, a default value of 300 seconds is used.
2d34536 to
6d436f3
Compare
|
I am supportive of a follow-up PR to add a CLI option. CLI is the most frequent use case. Having a CLI user setting an env var separately instead of having the option organically as part of their CLI workflow would be jarring. We probably also need an API option for users who use actions.py to publish to Connect. |
e778500 to
f1054aa
Compare
- make_html_bundle - make_html_bundle_content
remove create_abspath_list
7b30316 to
5c47917
Compare
|
Testing against the latest commit: I can't seem to get this to work. I'm testing a Jupiter notebook with a long running cell by including a Deploy command: I would expect this to timeout after 10 seconds. It does not, it deploys and renders properly in Connect. In the Connect application logs I see: Additionally I do not see any additional debugging info in the Connect application logs. Do I need to test this against a specific Connect branch? |
Hey @kgartland-rstudio , apologies if this wasn't clear. This change sets a timeout on the Instead of setting the I'm not entirely sure how the Otherwise, you may have to get creative. One idea I have is setting up macOS "Network Link Conditioner" to limit network speeds artificially. |
|
I was able to trigger the timeout but is there any way we can catch this exception and provide an error about how they increase the |
Sure! I will add an issue to the board and complete this in a separate pull request. |
|
Validated the var works and timeout is rsconnect-python clients in Windows and MacOS.
|
Adds support configurable HTTP and HTTPS request timeouts via the environment variable
CONNECT_REQUEST_TIMEOUT.Description
The current implementation uses hardcoded timeout values in different locations throughout the application. Typically, these pre-set timeouts are good enough. But, some users have requested the ability to configure timeouts to address unique constraints in their runtime environment.
This change removes all hardcoded timeouts, and replaces them with calls to
rsconnect.timeouts.get_timeout. In turn, this method retrieves the value from the environment variableCONNECT_REQUEST_TIMEOUT. If this variable is unset, a default value of 300 (i.e. 5 minutes) is used.Motivation and Context
Address Issue #346
Users have requested the ability to configure timeouts when running within a slow network.
This change does not add a corresponding CLI option. Doing so would greatly increase the scope of this pull request since the callstack from
rsconnect.maintorsconnect.http_support._connection_factoryis deep and the calls are numerous.If a CLI option is still needed, I would prefer to implement this change in a seperate pull request.
How Has This Been Tested?
Unit tests have been added to validate
rsconnect.timeouts.get_timeout.In addition, a DEBUG message has been added showing what the current timeout is set to for each HTTPConnect and HTTPSConnection.
Screenshots (if appropriate):
Types of Changes
This change alters the default values for timeouts, resulting in slightly different behavior for users. In most cases, this change will not be noticeable since the new default is greater than all previous defaults.
Checklist: