feat: catch all errors

This commit is contained in:
2025-04-12 21:58:19 +07:00
parent 27b4f4a9cc
commit 2ad2f9993e
2 changed files with 21 additions and 5 deletions

View File

@ -59,7 +59,18 @@ if (config.proxy.mode === "reflect4") {
logger.info(`Spawning ${config.proxy.count} proxies...`);
for (let i = 0; i < config.proxy.count; i++) {
logger.debug(`Spawning proxy ${i + 1}...`);
tasks.push(reflect4.spawn(context, config.playwright.url));
tasks.push((async () => {
const spawnId = `${i + 1}`;
while (true) {
try {
await reflect4.spawn(context, config.playwright.url, spawnId);
} catch (e) {
logger.error(`[${spawnId}] Error while running: ${e}`);
}
logger.warn(`[${spawnId}] Restarting in 3 seconds...`);
await new Promise(resolve => setTimeout(resolve, 3 * 1000));
}
})());
}
await Promise.all(tasks);
logger.info("All proxies spawned successfully.");