in api/index.js [189:208]
async function allStacks(buckets) {
const stateFileMetas = [];
for (const bucket of buckets) {
const [files] = await bucket.getFiles();
stateFileMetas.push(...files.filter((bucketFile) => bucketFile.name.includes('hub.state')));
}
console.log('Number of state files: ' + stateFileMetas.length);
const start = new Date().getTime();
const states = await allStates(stateFileMetas);
const end = new Date().getTime();
const time = (end - start) / 1000;
console.log('Time spent to unzip all state files: ' + time + ' seconds');
console.log('Average: ' + time / states.length + ' seconds per file');
stacks = [];
states.forEach((state) => {
stacks.push(stackMeta(load(state), true));
});
stacks.sort((x, y) => new Date(y.latestOperation.timestamp) - new Date(x.latestOperation.timestamp));
return stacks;
}