Skip to content

Commit

Permalink
chore: 下载插件也加入 retry 机制
Browse files Browse the repository at this point in the history
  • Loading branch information
hacke2 committed Oct 13, 2023
1 parent bf1bfd3 commit 6f66c7c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ const installExtension = async (namespace, name, version) => {
}

if (downloadUrl) {
const { targetDirName, tmpZipFile } = await downloadExtension(downloadUrl, namespace, name);

// 解压插件,使用 opentrs 插件时解压缩容易出错,因此这里加一个重试逻辑
await retry(() => unzipFile(targetDir, targetDirName, tmpZipFile), { retries: 5 });

rimraf.sync(tmpZipFile);
// 下载解压插件容易出错,因此这里加一个重试逻辑
await retry(() => {
const { targetDirName, tmpZipFile } = await downloadExtension(downloadUrl, namespace, name);
await unzipFile(targetDir, targetDirName, tmpZipFile);
rimraf.sync(tmpZipFile);
}, { retries: 5 });
}
};

Expand Down

0 comments on commit 6f66c7c

Please sign in to comment.