From 3cfe30ebfc4595fae440dca0887bc4243bae23e7 Mon Sep 17 00:00:00 2001 From: Erick2142 Date: Thu, 31 Oct 2024 09:38:11 -0400 Subject: [PATCH] Added a way to continue on multiple fails --- src/lib/api/import/index.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/lib/api/import/index.ts b/src/lib/api/import/index.ts index f8d9f172..4d8b5599 100644 --- a/src/lib/api/import/index.ts +++ b/src/lib/api/import/index.ts @@ -108,6 +108,7 @@ export async function importTarget( } let failedMoreThanOnce = false; +let ignoreMultipleFails = false; export async function importTargets( requestManager: requestsManager, targets: ImportTarget[], @@ -143,13 +144,23 @@ export async function importTargets( loggingPath, ); - if (failed % concurrentImports === 0) { + if (!ignoreMultipleFails && failed % concurrentImports === 0) { if (failedMoreThanOnce) { console.error( - `Every import in the last few batches failed, stopping as this is unexpected! Please check if everything is configured ok and review the logs located at ${loggingPath}/*. If everything looks OK re-start the import, previously imported targets will be skipped.`, + `Every import in the last few batches failed, stopping as this is unexpected! Please check if everything is configured ok and review the logs located at ${loggingPath}/*.`, ); - // die immediately - process.exit(1); + var rl = readline.createInterface({ + input: process.stdin, + output: process.stdout + }); + + rl.question("Do you want to continue anyway? (Y / N)", function(answer) { + answer = answer.toUpperCase(); + if(!(answer === "Y")){ + process.exit(1); + } + }); + ignoreMultipleFails = true; } failedMoreThanOnce = true; }