WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 0a70ddd

Browse files
committed
fix: keep sending generation status requests even when internet connection is lost
1 parent 1a1b2e4 commit 0a70ddd

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

custom/imageGenerator.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -376,20 +376,22 @@ async function generateImages() {
376376
method: 'POST',
377377
body: { jobId },
378378
});
379-
if (jobResponse?.error) {
380-
error = jobResponse.error;
381-
break;
382-
};
383-
jobStatus = jobResponse?.job?.status;
384-
if (jobStatus === 'failed') {
385-
error = jobResponse?.job?.error || $t('Image generation job failed');
386-
}
387-
if (jobStatus === 'timeout') {
388-
error = jobResponse?.job?.error || $t('Image generation job timeout');
379+
if (jobResponse !== null) {
380+
if (jobResponse?.error) {
381+
error = jobResponse.error;
382+
break;
383+
};
384+
jobStatus = jobResponse?.job?.status;
385+
if (jobStatus === 'failed') {
386+
error = jobResponse?.job?.error || $t('Image generation job failed');
387+
}
388+
if (jobStatus === 'timeout') {
389+
error = jobResponse?.job?.error || $t('Image generation job timeout');
390+
}
389391
}
390392
await new Promise((resolve) => setTimeout(resolve, 2000));
391-
} while (jobStatus === 'in_progress')
392-
393+
} while (jobStatus === 'in_progress' || jobStatus === null)
394+
393395
if (error) {
394396
adminforth.alert({
395397
message: error,

0 commit comments

Comments
 (0)