-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Overview
Add support for configuring the timeout parameter via the command line and as an environment variable.
Background
The current implementation uses a hardcoded timeout in 9 locations throughout the application. Each reference is within one of the following files. These references can also be found using the following regex search: timeout.*=\d+[,|)]
- https://github.com/rstudio/rsconnect-python/blob/b97d0b8ffaa3781654b03933b8705b95da4f4ca4/rsconnect/actions_content.py
- https://github.com/rstudio/rsconnect-python/blob/b97d0b8ffaa3781654b03933b8705b95da4f4ca4/rsconnect/api.py
- https://github.com/rstudio/rsconnect-python/blob/b97d0b8ffaa3781654b03933b8705b95da4f4ca4/rsconnect/http_support.py
Multiple customers have requested support for configurable timeouts to support nuances of their environment.
See issues:
Proposal
Define a new timeout option in the CLI interface that is optional. When not supplied by the user, the value will fall back to a method call. The method call will obtain a timeout value from an environment variable.
For example:
def get_timeout() -> int:
return int(os.environ.get("TIMEOUT", "60"))
@click.option(
"--timeout", prompt=True,
default=lambda: get_timeout()
)
Then, refactor uses of timeout throughout the application to use the get_timeout method by default. And refactor calls that use a timeout to pass the value down from the CLI option. In other words, refactor the application to use the CLI timeout parameter when invoked via the CLI interface. Otherwise, use the get_timeout method by default when invoked via the Python API.