mirror of
https://github.com/democratic-csi/democratic-csi.git
synced 2026-10-19 05:06:39 +02:00
throw error immediately when waiting for job instead of after making api requests
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
@@ -698,15 +698,16 @@ class Api {
|
||||
|
||||
// wait for job to finish
|
||||
do {
|
||||
currentTime = Date.now() / 1000;
|
||||
if (timeout > 0 && currentTime > startTime + timeout) {
|
||||
throw new Error("timeout waiting for job to complete");
|
||||
}
|
||||
|
||||
if (job) {
|
||||
await sleep(check_interval);
|
||||
}
|
||||
job = await this.CoreGetJobs({ id: job_id });
|
||||
job = job[0];
|
||||
currentTime = Date.now() / 1000;
|
||||
if (timeout > 0 && currentTime > startTime + timeout) {
|
||||
throw new Error("timeout waiting for job to complete");
|
||||
}
|
||||
} while (!["SUCCESS", "ABORTED", "FAILED"].includes(job.state));
|
||||
|
||||
return job;
|
||||
|
||||
Reference in New Issue
Block a user