Upon error, re-run the PoolsUpdater within 24h instead of 7d

This commit is contained in:
nymkappa 2022-04-07 14:51:23 +09:00
parent 1969f2a275
commit 2d29b9ef89
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -18,8 +18,11 @@ class PoolsUpdater {
return;
}
const oneWeek = 604800;
const oneDay = 86400;
const now = new Date().getTime() / 1000;
if (now - this.lastRun < 604800) { // Execute the PoolsUpdate only once a week, or upon restart
if (now - this.lastRun < oneWeek) { // Execute the PoolsUpdate only once a week, or upon restart
return;
}
@ -44,7 +47,8 @@ class PoolsUpdater {
logger.notice('PoolsUpdater completed');
} catch (e) {
logger.err('PoolsUpdater failed. Error: ' + e);
this.lastRun = now - oneWeek - oneDay; // Try again in 24h
logger.err('PoolsUpdater failed. Will try again in 24h. Error: ' + e);
}
}