Skip to content

Commit 2de86ac

Browse files
committed
Decrease poll time when pending
1 parent 8ba9ed1 commit 2de86ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

site/src/api/queries/templates.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,10 @@ const waitBuildToBeFinished = async (
288288
onRequest?: (data: TemplateVersion) => void,
289289
) => {
290290
let data: TemplateVersion;
291-
let jobStatus: ProvisionerJobStatus;
291+
let jobStatus: ProvisionerJobStatus | undefined = undefined;
292292
do {
293-
await delay(1000);
293+
// When pending we want to poll more frequently
294+
await delay(jobStatus === "pending" ? 250 : 1000);
294295
data = await API.getTemplateVersion(version.id);
295296
onRequest?.(data);
296297
jobStatus = data.job.status;

0 commit comments

Comments
 (0)