mirror of
https://github.com/mempool/mempool.git
synced 2025-03-13 11:36:07 +01:00
Skip existing mining pool logos when syncing assets
This commit is contained in:
parent
97c8ace8f7
commit
7f3e4eb534
1 changed files with 7 additions and 1 deletions
|
@ -56,9 +56,15 @@ function downloadMiningPoolLogos() {
|
|||
let response_body = Buffer.concat(chunks_of_data);
|
||||
try {
|
||||
const poolLogos = JSON.parse(response_body.toString());
|
||||
let downloadedCount = 0;
|
||||
for (const poolLogo of poolLogos) {
|
||||
download(`${PATH}/mining-pools/${poolLogo.name}`, poolLogo.download_url);
|
||||
const filePath = `${PATH}/mining-pools/${poolLogo.name}`;
|
||||
if (!fs.existsSync(filePath)) {
|
||||
download(filePath, poolLogo.download_url);
|
||||
downloadedCount++;
|
||||
}
|
||||
}
|
||||
console.log(`Downloaded ${downloadedCount} and skipped ${poolLogos.length - downloadedCount} existing mining pool logos`);
|
||||
} catch (e) {
|
||||
console.error(`Unable to download mining pool logos. Trying again at next restart. Reason: ${e instanceof Error ? e.message : e}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue