Compare commits

..

2 Commits

Author SHA1 Message Date
Mononaut
30ff1c55d3 clear miningstats cache on network change 2024-08-05 13:57:01 +00:00
wiz
5eb117165f Revert "ops: Remove potentially dangerous env var in rust build process"
This reverts commit a2dcf0d545.
2024-08-04 21:19:44 -04:00
2 changed files with 4 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ export class MiningService {
data: MiningStats;
}
} = {};
network: string;
poolsData: SinglePoolStats[] = [];
constructor(
@@ -44,7 +45,7 @@ export class MiningService {
*/
public getMiningStats(interval: string): Observable<MiningStats> {
// 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);
} else {
return this.apiService.listPools$(interval).pipe(
@@ -54,6 +55,7 @@ export class MiningService {
lastUpdated: Date.now(),
data: stats,
};
this.network = this.stateService.network;
})
);
}

View File

@@ -11,7 +11,7 @@
"build-release": "npm run build -- --release --strip",
"check-cargo-version": "VER=$(cat rust-toolchain) ; if ! cargo version | grep \"cargo $VER\" >/dev/null ; then echo -e \"\\033[1;35m[[[[WARNING]]]]: cargo version mismatch with ./rust-toolchain version ($VER)!!!\\033[0m\" >&2; fi",
"clean": "rm -rf ./target/ ./node_modules/ *.node package-lock.json",
"to-backend": "rm -rf ../../backend/rust-gbt && mkdir ../../backend/rust-gbt && cp index.js index.d.ts package.json *.node ../../backend/rust-gbt",
"to-backend": "FD=${FD:-../../backend/rust-gbt/} ; rm -rf $FD && mkdir $FD && cp index.js index.d.ts package.json *.node $FD",
"prepublishOnly": "napi prepublish -t npm",
"test": "cargo test"
},