mirror of
https://github.com/catdevnull/transicion-desordenada-diablo
synced 2024-11-15 02:21:39 +00:00
testear y documentar check duplicados
This commit is contained in:
parent
fb67c517f3
commit
e1e851f797
2 changed files with 7 additions and 16 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
node_modules/
|
||||
dataJsons/
|
||||
log
|
||||
prueba
|
|
@ -36,13 +36,16 @@ const jsonString = json.join("");
|
|||
const parsed = JSON.parse(jsonString);
|
||||
|
||||
const jobs = parsed.dataset.flatMap((dataset) =>
|
||||
dataset.distribution.map((dist) => ({ dataset, dist }))
|
||||
dataset.distribution.map((dist) => ({
|
||||
dataset,
|
||||
dist,
|
||||
url: new URL(dist.downloadURL),
|
||||
}))
|
||||
);
|
||||
// forma barrani de distribuir carga entre servidores
|
||||
shuffleArray(jobs);
|
||||
const totalJobs = jobs.length;
|
||||
let nFinished = 0;
|
||||
|
||||
// por las dudas verificar que no hayan archivos duplicados
|
||||
const duplicated = hasDuplicates(
|
||||
jobs.map((j) => `${j.dataset.identifier}/${j.dist.identifier}`)
|
||||
);
|
||||
|
@ -152,19 +155,6 @@ function hasDuplicates(array) {
|
|||
return new Set(array).size !== array.length;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/12646864
|
||||
/**
|
||||
* @argument {any[]} array
|
||||
*/
|
||||
function shuffleArray(array) {
|
||||
for (var i = array.length - 1; i > 0; i--) {
|
||||
var j = Math.floor(Math.random() * (i + 1));
|
||||
var temp = array[i];
|
||||
array[i] = array[j];
|
||||
array[j] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @argument {number} ms
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue