Compare commits
1 Commits
master
...
mononaut/m
Author | SHA1 | Date | |
---|---|---|---|
|
30ff1c55d3 |
@ -31,6 +31,7 @@ export class MiningService {
|
|||||||
data: MiningStats;
|
data: MiningStats;
|
||||||
}
|
}
|
||||||
} = {};
|
} = {};
|
||||||
|
network: string;
|
||||||
poolsData: SinglePoolStats[] = [];
|
poolsData: SinglePoolStats[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -44,7 +45,7 @@ export class MiningService {
|
|||||||
*/
|
*/
|
||||||
public getMiningStats(interval: string): Observable<MiningStats> {
|
public getMiningStats(interval: string): Observable<MiningStats> {
|
||||||
// returned cached data fetched within the last 5 minutes
|
// returned cached data fetched within the last 5 minutes
|
||||||
if (this.cache[interval] && this.cache[interval].lastUpdated > (Date.now() - (5 * 60000))) {
|
if (this.cache[interval] && this.cache[interval].lastUpdated > (Date.now() - (5 * 60000)) && this.network === this.stateService.network) {
|
||||||
return of(this.cache[interval].data);
|
return of(this.cache[interval].data);
|
||||||
} else {
|
} else {
|
||||||
return this.apiService.listPools$(interval).pipe(
|
return this.apiService.listPools$(interval).pipe(
|
||||||
@ -54,6 +55,7 @@ export class MiningService {
|
|||||||
lastUpdated: Date.now(),
|
lastUpdated: Date.now(),
|
||||||
data: stats,
|
data: stats,
|
||||||
};
|
};
|
||||||
|
this.network = this.stateService.network;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user