Skip to content

Commit 0f8898d

Browse files
dragonstylecscheid
authored andcommitted
Add 20 minute timeout to notarization
1 parent 93bd59b commit 0f8898d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

package/src/macos/installer.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,13 @@ async function waitForNotaryStatus(
328328
username: string,
329329
password: string,
330330
) {
331+
const starttime = Date.now();
332+
333+
// 20 minutes
334+
const msToWait = 1200000;
335+
336+
const pollIntervalSeconds = 15;
337+
331338
let errorCount = 0;
332339
let notaryResult = undefined;
333340
while (notaryResult == undefined) {
@@ -352,7 +359,9 @@ async function waitForNotaryStatus(
352359
errorCount = 0;
353360

354361
// Sleep for 15 seconds between checks
355-
await new Promise((resolve) => setTimeout(resolve, 15 * 1000));
362+
await new Promise((resolve) =>
363+
setTimeout(resolve, pollIntervalSeconds * 1000)
364+
);
356365
} else if (status === "success") {
357366
notaryResult = "Success";
358367
} else {
@@ -365,6 +374,13 @@ async function waitForNotaryStatus(
365374
errorCount = errorCount + 1;
366375
}
367376
}
377+
if (Date.now() - starttime > msToWait) {
378+
throw new Error(
379+
`Failed to Notarize - timed out after ${
380+
msToWait / 1000
381+
} seconds when awaiting notarization`,
382+
);
383+
}
368384
}
369385
return notaryResult;
370386
}

0 commit comments

Comments
 (0)