mirror of
https://github.com/mempool/mempool.git
synced 2025-02-25 07:07:36 +01:00
Add retry logic to acceleration data fetching on tx page
This commit is contained in:
parent
645fd98c30
commit
4470461a98
1 changed files with 12 additions and 4 deletions
|
@ -317,11 +317,19 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
this.setIsAccelerated();
|
this.setIsAccelerated();
|
||||||
}),
|
}),
|
||||||
switchMap((blockHeight: number) => {
|
switchMap((blockHeight: number) => {
|
||||||
return this.servicesApiService.getAccelerationHistory$({ blockHeight });
|
return this.servicesApiService.getAccelerationHistory$({ blockHeight }).pipe(
|
||||||
|
switchMap((accelerationHistory: Acceleration[]) => {
|
||||||
|
if (this.tx.acceleration && !accelerationHistory.length) { // If the just mined transaction was accelerated, but services backend did not return any acceleration data, retry
|
||||||
|
return throwError('retry');
|
||||||
|
}
|
||||||
|
return of(accelerationHistory);
|
||||||
}),
|
}),
|
||||||
|
retry({ count: 3, delay: 2000 }),
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
return of([]);
|
return of([]);
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
}),
|
||||||
).subscribe((accelerationHistory) => {
|
).subscribe((accelerationHistory) => {
|
||||||
for (const acceleration of accelerationHistory) {
|
for (const acceleration of accelerationHistory) {
|
||||||
if (acceleration.txid === this.txId && (acceleration.status === 'completed' || acceleration.status === 'completed_provisional')) {
|
if (acceleration.txid === this.txId && (acceleration.status === 'completed' || acceleration.status === 'completed_provisional')) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue