Fix error with async downloading git repos from IPFS gateways
This commit is contained in:
parent
26a4616c10
commit
369040a409
@ -5,7 +5,7 @@ if [ "$EUID" -ne 0 ];
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
this_repo_ipfs_cid="bafybeig4t3ntvqc2skn3qhgr7dhnpzikxxyya6zptonorbcjdsv5emvj7q";
|
||||
this_repo_ipfs_cid="bafybeiepown476yzjs2zcymrn3t7d4oseuaw6a2rjnkdbu73jrp3evfdxm";
|
||||
user_home_dir=$(eval echo ~$USER);
|
||||
tornado_folder="$user_home_dir/tornado-ipfs";
|
||||
script_log_file="/tmp/tornado-ipfs-installation.log";
|
||||
|
@ -41,11 +41,11 @@ export async function getV1Cids(domains: Domains): Promise<IPFSCids> {
|
||||
}
|
||||
|
||||
export async function downloadGitRepoFromIpfs(reposFolder: string, repoName: string, repoHash: string, retryAttempt: number = 0) {
|
||||
if (retryAttempt > knownIpfsResources.length) return console.error(`Cannot download ${repoName}, all known IPFS gateaways checked.`);
|
||||
if (retryAttempt >= knownIpfsResources.length) return console.error(`Cannot download ${repoName}, all known IPFS gateways checked.`);
|
||||
try {
|
||||
await git.clone(knownIpfsResources[retryAttempt] + repoHash, path.join(reposFolder, repoName));
|
||||
} catch (e) {
|
||||
console.error(`Cannot download ${repoName} from ${knownIpfsResources[retryAttempt]}, retry with other gateaway...`);
|
||||
downloadGitRepoFromIpfs(reposFolder, repoName, repoHash, retryAttempt++);
|
||||
console.error(`Cannot download ${repoName} from ${knownIpfsResources[retryAttempt]}, retry with other gateway...`);
|
||||
await downloadGitRepoFromIpfs(reposFolder, repoName, repoHash, ++retryAttempt);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user