Closed car1bo closed 10 months ago
Hi @car1bo, thanks for the idea and PR! Since this is an instance level issue, would we be better served by including this in session creation, New-ServiceNowSession? That way the timeout value would be used for every function. Thoughts?
@car1bo following up....
@car1bo one last try
I'm not the issue submitter, but as a consumer of a busy ServiceNow instance myself, I'd find that allowing a timeout value to be set would help avoid scripts hanging indefinitely. I would agree that setting the preferred timeout via New-ServiceNowSession
would be best so that all functions interacting with the instance would share the same timeout.
Thanks @gregharms, I appreciate the feedback. I've added this functionality.
Summary of the new feature/enhancement
When running Get-ServiceNowRecord against busy instances, it appears that sometimes the server does not respond, and the request hangs indefinitely. The documentation for Invoke-WebRequest states that the default value for TimeOutSec is zero which represents an indefinite timeout.
Proposed technical implementation details
Add an optional parameter to Get-ServiceNowRecord for TimeOutSec which is then passed through Invoke-ServiceNowRestMethod to the Invoke-WebRequest function.