Skip to content

Commit 71215a6

Browse files
committed
QFIX: Add retry to notarize (#7912)
Signed-off-by: Andrey Sobolev <[email protected]>
1 parent 10bf74a commit 71215a6

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

Diff for: desktop-package/scripts/notarize.js

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
require('dotenv').config();
22
const { notarize } = require('@electron/notarize');
33

4+
async function retryNotarize(options, retries = 5, delay = 5000) {
5+
for (let i = 0; i < retries; i++) {
6+
try {
7+
console.log(`Attempt ${i + 1} to notarize...`);
8+
await notarize(options);
9+
console.log('Notarization successful');
10+
return;
11+
} catch (error) {
12+
console.error(`Notarization attempt ${i + 1} failed:`, error);
13+
if (i < retries - 1) {
14+
console.log(`Retrying in ${delay / 1000} seconds...`);
15+
await new Promise(resolve => setTimeout(resolve, delay));
16+
delay *= 2; // Increase delay for the next retry
17+
} else {
18+
console.log('All notarization attempts failed...');
19+
// Add any necessary teardown logic here
20+
throw error;
21+
}
22+
}
23+
}
24+
}
25+
426
exports.default = async function notarizing(context) {
527
const { electronPlatformName, appOutDir } = context;
628
if (electronPlatformName !== 'darwin') {
@@ -9,8 +31,8 @@ exports.default = async function notarizing(context) {
931

1032
const appName = context.packager.appInfo.productFilename;
1133

12-
console.log('Starting custom notarization process...')
13-
return await notarize({
34+
console.log('Starting custom notarization process...');
35+
await retryNotarize({
1436
appPath: `${appOutDir}/${appName}.app`,
1537
appleId: process.env.APPLE_ID,
1638
appleIdPassword: process.env.APPLE_ID_APP_PASS,

0 commit comments

Comments
 (0)