mirror of
https://github.com/mempool/mempool.git
synced 2025-02-24 22:58:30 +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();
|
||||
}),
|
||||
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(() => {
|
||||
return of([]);
|
||||
})
|
||||
);
|
||||
}),
|
||||
catchError(() => {
|
||||
return of([]);
|
||||
})
|
||||
).subscribe((accelerationHistory) => {
|
||||
for (const acceleration of accelerationHistory) {
|
||||
if (acceleration.txid === this.txId && (acceleration.status === 'completed' || acceleration.status === 'completed_provisional')) {
|
||||
|
|
Loading…
Add table
Reference in a new issue