Skip to content

Commit

Permalink
End polling if DoesNotExist terminal state found (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
cleve-fauna authored Sep 27, 2022
1 parent a13dd78 commit 0e0dd95
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async function receiveQuerylogs(regionGroupCreds) {
continue;
}
if (e.response?.status === 401) {
log_red("You've lost your session - another client may have logged in with these credentials; please run the demo again.");cos
log_red("You've lost your session - another client may have logged in with these credentials; please run the demo again.");
process.exit(1);
}
logger.error(e.response?.data);
Expand All @@ -120,7 +120,7 @@ async function receiveQuerylogs(regionGroupCreds) {
await new Promise((resolve) => setTimeout(resolve, 1000));
} while (
Date.now() < startTime + maxRuntimeMs &&
!["Complete", "Failed"].includes(result.state)
!["Complete", "Failed", "DoesNotExist"].includes(result.state)
);
if (result.state === "Complete") {
log_green("Complete! Final response:");
Expand Down Expand Up @@ -168,9 +168,7 @@ async function receiveQuerylogs(regionGroupCreds) {
console.log(result);
log_yellow("No query logs exist for your request. As such, the final response is 'DoesNotExist' with no URL.");
} else {
log_yellow(`The logs have been requested but not yet received. If you requested
logs for a time-range with no activity, currently the request freezes.
This is an open item we are actively working on fixing.`);
log_yellow(`The logs have been requested but not yet received. Please retry, or cut support an issue if you continue to see this.`);
console.log(result);
}
}
Expand Down

0 comments on commit 0e0dd95

Please sign in to comment.