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

RestClient methods to have a configurable timeout #2333

Open
sosadchuk opened this issue Oct 30, 2024 · 1 comment
Open

RestClient methods to have a configurable timeout #2333

sosadchuk opened this issue Oct 30, 2024 · 1 comment
Labels
enhancement New feature or request priority-medium Not functioning - next quarter if capacity permits

Comments

@sosadchuk
Copy link

Hi,

The RestClient class static methods lack timeout support for client-side connection errors like host resolution. The default NodeJS timeout would be around 2-3 minutes, which might be too much.

The http module already supports timeouts (see the ClientRequestArgs interface), and the AbstractRestClient.request() could be ehanced to set timeout option either in the .buildOptions() method, or by calling the clientRequest.setTimeout(N); after creating one of http/https clients.

In addition to that an event listener is needed, similar to the one you have for the error event:

clientRequest.on("timeout", () => {
                reject(this.populateError({
                    msg: "Failed to send an HTTP request.",
                    causeErrors: "Connection timeout.",
                    source: "client"
                }));
            });

And the last item would be the RestClient which methods need to accept and bypass the timeout option. I believe a static property common for all requests should be fine.

Thanks,
Sergei.

@sosadchuk sosadchuk added enhancement New feature or request new The issue wasn't triaged yet labels Oct 30, 2024
Copy link

Thank you for raising this enhancement request.
The community has 90 days to vote on it.
If the enhancement receives at least 5 upvotes, it is added to our development backlog.
If it receives fewer votes, the issue is closed.

@JTonda JTonda added priority-medium Not functioning - next quarter if capacity permits and removed new The issue wasn't triaged yet labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority-medium Not functioning - next quarter if capacity permits
Projects
Status: Medium Priority
Development

No branches or pull requests

2 participants