Skip to content

Commit d276fc6

Browse files
committed
Added retries for download external extensions.
1 parent b8ee508 commit d276fc6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

scripts/packageManifestV2Extensions.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import glob from 'glob'
1111
import util from '../lib/util.js'
1212
import crx from '../lib/crx.js'
1313

14-
const downloadExtension = async (config) => {
14+
const downloadExtensionInternal = async (config) => {
1515
const buildPath = path.join('build', config.name)
1616
const download = path.join(buildPath, 'download')
1717
const unpacked = path.join(buildPath, 'unpacked')
@@ -59,6 +59,21 @@ const downloadExtension = async (config) => {
5959
}
6060
}
6161

62+
const downloadExtension = async (config) => {
63+
const maxAttempts = 3
64+
for (let attempt = 1; attempt <= maxAttempts; ++attempt) {
65+
try {
66+
return await downloadExtensionInternal(config)
67+
} catch (error) {
68+
if (attempt < maxAttempts) {
69+
await new Promise(resolve => setTimeout(resolve, 5000 * attempt))
70+
} else {
71+
throw error
72+
}
73+
}
74+
}
75+
}
76+
6277
const getExtensionConfig = (extensionName) => {
6378
return path.join('manifests', extensionName, 'config.json')
6479
}

0 commit comments

Comments
 (0)