Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
fix: Disable request cancellation (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Sep 2, 2020
1 parent 507abc5 commit b5f004b
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/jsonwp-proxy/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ class JWProxy {
});
this.scheme = this.scheme.toLowerCase();
this._activeRequests = [];
this._reqCancelSource = axios.CancelToken.source();
this._downstreamProtocol = null;
const agentOpts = {
keepAlive: opts.keepAlive ?? true,
maxSockets: 30,
maxFreeSockets: 10,
maxSockets: 10,
maxFreeSockets: 5,
timeout: 60000,
};
this.httpAgent = new http.Agent(agentOpts);
Expand Down Expand Up @@ -73,11 +72,7 @@ class JWProxy {
}

cancelActiveRequests () {
try {
this._reqCancelSource.cancel('The request has been canceled');
} finally {
this._activeRequests = [];
}
this._activeRequests = [];
}

endpointRequiresSessionId (endpoint) {
Expand Down Expand Up @@ -159,7 +154,6 @@ class JWProxy {
timeout: this.timeout,
httpAgent: this.httpAgent,
httpsAgent: this.httpsAgent,
cancelToken: this._reqCancelSource.token,
};
// GET methods shouldn't have any body. Most servers are OK with this, but WebDriverAgent throws 400 errors
if (util.hasValue(body) && method !== 'GET') {
Expand Down

0 comments on commit b5f004b

Please sign in to comment.