File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ interface IConfig {
32
32
AUTOMATIC_POOLS_UPDATE : boolean ;
33
33
POOLS_JSON_URL : string ,
34
34
POOLS_JSON_TREE_URL : string ,
35
+ POOLS_UPDATE_DELAY : number ,
35
36
AUDIT : boolean ;
36
37
RUST_GBT : boolean ;
37
38
LIMIT_GBT : boolean ;
@@ -192,6 +193,7 @@ const defaults: IConfig = {
192
193
'AUTOMATIC_POOLS_UPDATE' : false ,
193
194
'POOLS_JSON_URL' : 'https://raw.githubusercontent.com/mempool/mining-pools/master/pools-v2.json' ,
194
195
'POOLS_JSON_TREE_URL' : 'https://api.github.com/repos/mempool/mining-pools/git/trees/master' ,
196
+ 'POOLS_UPDATE_DELAY' : 604800 , // in seconds, default is one week
195
197
'AUDIT' : false ,
196
198
'RUST_GBT' : false ,
197
199
'LIMIT_GBT' : false ,
Original file line number Diff line number Diff line change @@ -239,6 +239,7 @@ class Server {
239
239
if ( config . FIAT_PRICE . ENABLED ) {
240
240
priceUpdater . $run ( ) ;
241
241
}
242
+ await poolsUpdater . updatePoolsJson ( ) ;
242
243
243
244
// rerun immediately if we skipped the mempool update, otherwise wait POLL_RATE_MS
244
245
const elapsed = Date . now ( ) - start ;
Original file line number Diff line number Diff line change @@ -23,11 +23,8 @@ class PoolsUpdater {
23
23
return ;
24
24
}
25
25
26
- const oneWeek = 604800 ;
27
- const oneDay = 86400 ;
28
-
29
26
const now = new Date ( ) . getTime ( ) / 1000 ;
30
- if ( now - this . lastRun < oneWeek ) { // Execute the PoolsUpdate only once a week, or upon restart
27
+ if ( now - this . lastRun < config . MEMPOOL . POOLS_UPDATE_DELAY ) { // Execute the PoolsUpdate only once a week, or upon restart
31
28
return ;
32
29
}
33
30
@@ -87,8 +84,8 @@ class PoolsUpdater {
87
84
logger . info ( `Mining pools-v2.json (${ githubSha } ) import completed` ) ;
88
85
89
86
} catch ( e ) {
90
- this . lastRun = now - ( oneWeek - oneDay ) ; // Try again in 24h instead of waiting next week
91
- logger . err ( `PoolsUpdater failed. Will try again in 24h . Exception: ${ JSON . stringify ( e ) } ` , logger . tags . mining ) ;
87
+ this . lastRun = now - 600 ; // Try again in 10 minutes
88
+ logger . err ( `PoolsUpdater failed. Will try again in 10 minutes . Exception: ${ JSON . stringify ( e ) } ` , logger . tags . mining ) ;
92
89
}
93
90
}
94
91
You can’t perform that action at this time.
0 commit comments