Merge pull request #2923 from mempool/nymkappa/bugfix/ignore-pools-logo-failure

Ignore pool logo download failure as it's not a critical error
This commit is contained in:
softsimon 2023-01-11 00:13:08 +04:00 committed by GitHub
commit 5f87d6c4f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,9 +54,13 @@ function downloadMiningPoolLogos() {
response.on('end', () => { response.on('end', () => {
let response_body = Buffer.concat(chunks_of_data); let response_body = Buffer.concat(chunks_of_data);
const poolLogos = JSON.parse(response_body.toString()); try {
for (const poolLogo of poolLogos) { const poolLogos = JSON.parse(response_body.toString());
download(`${PATH}/mining-pools/${poolLogo.name}`, poolLogo.download_url); for (const poolLogo of poolLogos) {
download(`${PATH}/mining-pools/${poolLogo.name}`, poolLogo.download_url);
}
} catch (e) {
console.error(`Unable to download mining pool logos. Trying again at next restart. Reason: ${e instanceof Error ? e.message : e}`);
} }
}); });