kopia lustrzana https://gitlab.com/rysiekpl/libresilient
alt-fetch: append the path after selecting the endpoints (fixes #55)
rodzic
6bef03ef0b
commit
fcb02ade52
|
@ -79,18 +79,23 @@
|
|||
// if we have fewer than the configured concurrency or just as many, use all of them
|
||||
if (sourceEndpoints.length <= config.concurrency) {
|
||||
var useEndpoints = sourceEndpoints
|
||||
|
||||
// otherwise get `config.concurrency` endpoints at random
|
||||
} else {
|
||||
var useEndpoints = new Array()
|
||||
while (useEndpoints.length < config.concurrency) {
|
||||
// put in the address while we're at it
|
||||
useEndpoints.push(
|
||||
sourceEndpoints
|
||||
.splice(Math.floor(Math.random() * sourceEndpoints.length), 1)[0] + path
|
||||
.splice(Math.floor(Math.random() * sourceEndpoints.length), 1)[0]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// add the rest of the path to each endpoint
|
||||
useEndpoints.forEach((endpoint, index) => {
|
||||
useEndpoints[index] = endpoint + path;
|
||||
});
|
||||
|
||||
// debug log
|
||||
LR.log(pluginName, `fetching from alternative endpoints:\n ${useEndpoints.join('\n ')}`)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue