Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added a way to continue on multiple fails #496

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/lib/api/import/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export async function importTarget(
}

let failedMoreThanOnce = false;
let ignoreMultipleFails = false;
export async function importTargets(
requestManager: requestsManager,
targets: ImportTarget[],
Expand Down Expand Up @@ -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;
}
Expand Down