gax-nodejs icon indicating copy to clipboard operation
gax-nodejs copied to clipboard

fix: enable keepAlive for HTTP requests

Open alexander-fenster opened this issue 1 year ago • 0 comments

As described in https://github.com/node-fetch/node-fetch#custom-agent, the keepalive option is not enabled by default until Node.js v19, which makes HTTP requests reconnect for each request.

In this PR I will add Node.js HTTP/HTTPS agent initialization as suggested at the link above; I'm doing it in this somewhat hacky way instead of regular import * as https from 'https' to make sure the non-Node scenarios are not broken by this.

Let's see if it helps!

alexander-fenster avatar Jan 11 '24 20:01 alexander-fenster