Reduce outspend API cache expiry to 250ms

This commit is contained in:
Mononaut 2023-11-11 07:46:25 +00:00
parent 3f0c3c1952
commit 6740ab61f3
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
2 changed files with 3 additions and 4 deletions

View File

@ -53,7 +53,6 @@ export class TransactionsListComponent implements OnInit, OnChanges {
private assetsService: AssetsService, private assetsService: AssetsService,
private ref: ChangeDetectorRef, private ref: ChangeDetectorRef,
private priceService: PriceService, private priceService: PriceService,
private cd: ChangeDetectorRef,
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
@ -76,7 +75,7 @@ export class TransactionsListComponent implements OnInit, OnChanges {
for (let i = 0; i < txIds.length; i += 50) { for (let i = 0; i < txIds.length; i += 50) {
batches.push(txIds.slice(i, i + 50)); batches.push(txIds.slice(i, i + 50));
} }
return forkJoin(batches.map(batch => { return this.apiService.cachedRequest(this.apiService.getOutspendsBatched$, 5000, batch); })); return forkJoin(batches.map(batch => { return this.apiService.cachedRequest(this.apiService.getOutspendsBatched$, 250, batch); }));
} else { } else {
return of([]); return of([]);
} }
@ -91,7 +90,7 @@ export class TransactionsListComponent implements OnInit, OnChanges {
outspends.forEach((outspend, i) => { outspends.forEach((outspend, i) => {
transactions[i]._outspends = outspend; transactions[i]._outspends = outspend;
}); });
this.cd.markForCheck(); this.ref.markForCheck();
}), }),
), ),
this.stateService.utxoSpent$ this.stateService.utxoSpent$

View File

@ -123,7 +123,7 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges {
.pipe( .pipe(
switchMap((txid) => { switchMap((txid) => {
if (!this.cached) { if (!this.cached) {
return this.apiService.cachedRequest(this.apiService.getOutspendsBatched$, 5000, [txid]); return this.apiService.cachedRequest(this.apiService.getOutspendsBatched$, 250, [txid]);
} else { } else {
return of(null); return of(null);
} }