diff --git a/plugins/alt-fetch/index.js b/plugins/alt-fetch/index.js index 4056eca..1ac8a03 100644 --- a/plugins/alt-fetch/index.js +++ b/plugins/alt-fetch/index.js @@ -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 ')}`)