Permalink
Cannot retrieve contributors at this time
32 lines (32 sloc)
1.18 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/@actions/artifact/lib/internal/http-manager.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.HttpManager = void 0; | |
const utils_1 = require("./utils"); | |
/** | |
* Used for managing http clients during either upload or download | |
*/ | |
class HttpManager { | |
constructor(clientCount, userAgent) { | |
if (clientCount < 1) { | |
throw new Error('There must be at least one client'); | |
} | |
this.userAgent = userAgent; | |
this.clients = new Array(clientCount).fill(utils_1.createHttpClient(userAgent)); | |
} | |
getClient(index) { | |
return this.clients[index]; | |
} | |
// client disposal is necessary if a keep-alive connection is used to properly close the connection | |
// for more information see: https://github.com/actions/http-client/blob/04e5ad73cd3fd1f5610a32116b0759eddf6570d2/index.ts#L292 | |
disposeAndReplaceClient(index) { | |
this.clients[index].dispose(); | |
this.clients[index] = utils_1.createHttpClient(this.userAgent); | |
} | |
disposeAndReplaceAllClients() { | |
for (const [index] of this.clients.entries()) { | |
this.disposeAndReplaceClient(index); | |
} | |
} | |
} | |
exports.HttpManager = HttpManager; | |
//# sourceMappingURL=http-manager.js.map |