mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: stronger threshold
This commit is contained in:
1 parent
324cfe3927
commit
b216c1e6b8
1 file changed
+11
-6
+11
-6
@@ -11,7 +11,7 @@ import { DidsReadStream, DidsWriteStream } from '../src/core/streams/dids';
|
|||||||
const RUN_TIME = 1000 * 60 * 60 * 5.5;
|
const RUN_TIME = 1000 * 60 * 60 * 5.5;
|
||||||
const MAX_REQUESTS = 10;
|
const MAX_REQUESTS = 10;
|
||||||
const ACCOUNTS_PER_CALL = 100;
|
const ACCOUNTS_PER_CALL = 100;
|
||||||
const REMOVE_REGION_THRESHOLD = 10;
|
const TERMINATION_THRESHOLD = 1000;
|
||||||
|
|
||||||
const production = argv.includes('--production');
|
const production = argv.includes('--production');
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
@@ -26,6 +26,13 @@ const preDiscoveredRaw = await fetch(
|
|||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (preDiscoveredRaw === undefined) {
|
||||||
|
console.log('No pre-discovered ids found :(');
|
||||||
|
} else {
|
||||||
|
console.log(`Found ${preDiscoveredRaw.length} pre-discovered ids`);
|
||||||
|
}
|
||||||
|
|
||||||
const ids: number[] = [...(preDiscoveredRaw ?? [])]; // TODO: re-validate these ids
|
const ids: number[] = [...(preDiscoveredRaw ?? [])]; // TODO: re-validate these ids
|
||||||
const regionalIdIndex: Record<Region, number> = {
|
const regionalIdIndex: Record<Region, number> = {
|
||||||
asia: ids.find((id) => idToRegion(id) === 'asia') ?? MIN_IDS.asia,
|
asia: ids.find((id) => idToRegion(id) === 'asia') ?? MIN_IDS.asia,
|
||||||
@@ -64,10 +71,12 @@ const interval = setInterval(async () => {
|
|||||||
);
|
);
|
||||||
const verified = await verify(region, idsToVerify);
|
const verified = await verify(region, idsToVerify);
|
||||||
|
|
||||||
|
console.log(`${region.padEnd(4)} ${verified.length.toString().padStart(3)}`);
|
||||||
|
|
||||||
if (verified.length === 0) {
|
if (verified.length === 0) {
|
||||||
zeroStreak[region]++;
|
zeroStreak[region]++;
|
||||||
|
|
||||||
if (zeroStreak[region] >= REMOVE_REGION_THRESHOLD) {
|
if (zeroStreak[region] >= TERMINATION_THRESHOLD) {
|
||||||
const sliceableIndex = indexableRegions.indexOf(region);
|
const sliceableIndex = indexableRegions.indexOf(region);
|
||||||
|
|
||||||
if (sliceableIndex !== -1) {
|
if (sliceableIndex !== -1) {
|
||||||
@@ -81,10 +90,6 @@ const interval = setInterval(async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
|
||||||
`${region.padEnd(4)} ${verified.length.toString().padStart(3)}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
zeroStreak[region] = 0;
|
zeroStreak[region] = 0;
|
||||||
ids.push(...verified);
|
ids.push(...verified);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user