Skip to content
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

Allow specifying a Timeout value #237

Closed
Saadi6 opened this issue Dec 10, 2023 · 1 comment · Fixed by #240
Closed

Allow specifying a Timeout value #237

Saadi6 opened this issue Dec 10, 2023 · 1 comment · Fixed by #240
Assignees
Labels
enhancement New feature or request

Comments

@Saadi6
Copy link
Collaborator

Saadi6 commented Dec 10, 2023

Summary of the new feature/enhancement

Invoke-WebRequest and Invoke-RestMethod in PowerShell 5.1 have a default timeout of 0 (wait forever). Often times this behaviour is undesirable since this blocks program's execution. Venafi itself imposes a 120 seconds limit on Adaptable framework scripts, which is sometimes hit because Venafi PS was waiting on response from server while creating a new session. Often times this is due to temporary environmental factors such as badly configured load-balancers, network latency, load on server, etc.

Since a developer can anticipate suitable timeout value for an environment they are developing for, ability to set timeout provides a much better way to handle such condition. For e.g. trying again for such (web) exceptions or handling the error differently and then exiting gracefully instead of endlessly waiting or having the entire program forcefully terminated.

While it is possible to define a global timeout using ServicePointManager, this would effect every HTTP request made by the script, and not just the ones made by Venafi PS itself.

Proposed technical implementation details (optional)

Setting Timeout can be achieved by passing a value for timeout property of the underlaying Invoke-WebRequest method with each call to Venafi PS function and/or allow setting a value for timeout when creating a new Venafi session object, which is used while establishing the session and subsequently by all functions when they invoke a call to Venafi’s API.

@Saadi6 Saadi6 added the enhancement New feature or request label Dec 10, 2023
@gdbarron gdbarron self-assigned this Dec 11, 2023
gdbarron pushed a commit that referenced this issue Dec 15, 2023
@gdbarron gdbarron linked a pull request Dec 15, 2023 that will close this issue
Copy link

This issue is stale because it has been open for 60 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants