mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
Update discoverIds.ts
This commit is contained in:
1 parent
1fd9c9e6b0
commit
e370a53473
1 file changed
+3
-5
@@ -1,4 +1,4 @@
|
|||||||
import { chunk, times } from 'lodash';
|
import { chunk, times, uniq } from 'lodash';
|
||||||
import { compress, decompress } from 'lz4js';
|
import { compress, decompress } from 'lz4js';
|
||||||
import { argv } from 'process';
|
import { argv } from 'process';
|
||||||
import { REGIONS, Region } from '../src/constants/regions';
|
import { REGIONS, Region } from '../src/constants/regions';
|
||||||
@@ -48,9 +48,7 @@ while (chunkIndex < preDiscoveredManifest.chunks) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// no spread syntax: https://github.com/oven-sh/bun/issues/11734
|
// no spread syntax: https://github.com/oven-sh/bun/issues/11734
|
||||||
preDiscovered.forEach((id) => {
|
preDiscovered.forEach((id) => ids.push(id));
|
||||||
if (!ids.includes(id)) ids.push(id);
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`Pre-discovered ${preDiscovered.length} ids (chunk ${chunkIndex})`,
|
`Pre-discovered ${preDiscovered.length} ids (chunk ${chunkIndex})`,
|
||||||
@@ -138,7 +136,7 @@ function post() {
|
|||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
console.log(`Uploading ${ids.length} ids...`);
|
console.log(`Uploading ${ids.length} ids...`);
|
||||||
|
|
||||||
const idsSorted = ids.sort((a, b) => a - b);
|
const idsSorted = uniq(ids).sort((a, b) => a - b);
|
||||||
const idsChunked = chunk(idsSorted, CHUNK_SIZE);
|
const idsChunked = chunk(idsSorted, CHUNK_SIZE);
|
||||||
const files = idsChunked.map((ids, chunk) => {
|
const files = idsChunked.map((ids, chunk) => {
|
||||||
const didsWriteStream = new DidsWriteStream().dids(ids);
|
const didsWriteStream = new DidsWriteStream().dids(ids);
|
||||||
|
|||||||
Reference in new issue
Block a user