Add throttleTime to avoid too frequent calls to backend
This commit is contained in:
		
							parent
							
								
									81a09e9dba
								
							
						
					
					
						commit
						8f7cd70882
					
				| @ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; | ||||
| import { SeoService } from '../../../services/seo.service'; | ||||
| import { WebsocketService } from '../../../services/websocket.service'; | ||||
| import { StateService } from '../../../services/state.service'; | ||||
| import { Observable, concat, delay, filter, share, skip, switchMap, tap } from 'rxjs'; | ||||
| import { Observable, concat, delay, filter, share, skip, switchMap, tap, throttleTime } from 'rxjs'; | ||||
| import { ApiService } from '../../../services/api.service'; | ||||
| import { AuditStatus, CurrentPegs, FederationAddress, FederationUtxo } from '../../../interfaces/node-api.interface'; | ||||
| 
 | ||||
| @ -38,6 +38,7 @@ export class ReservesAuditDashboardComponent implements OnInit { | ||||
|       this.apiService.federationAuditSynced$().pipe(share()), | ||||
|       this.stateService.blocks$.pipe( | ||||
|         skip(1), | ||||
|         throttleTime(40000), | ||||
|         delay(2000), | ||||
|         switchMap(() => this.apiService.federationAuditSynced$()), | ||||
|         share() | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { AfterViewInit, ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core'; | ||||
| import { combineLatest, concat, EMPTY, interval, merge, Observable, of, Subscription } from 'rxjs'; | ||||
| import { catchError, delay, filter, map, mergeMap, scan, share, skip, startWith, switchMap, tap } from 'rxjs/operators'; | ||||
| import { catchError, delay, filter, map, mergeMap, scan, share, skip, startWith, switchMap, tap, throttleTime } from 'rxjs/operators'; | ||||
| import { AuditStatus, BlockExtended, CurrentPegs, OptimizedMempoolStats } from '../interfaces/node-api.interface'; | ||||
| import { MempoolInfo, TransactionStripped, ReplacementInfo } from '../interfaces/websocket.interface'; | ||||
| import { ApiService } from '../services/api.service'; | ||||
| @ -252,6 +252,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit { | ||||
|         this.apiService.federationAuditSynced$().pipe(share()), | ||||
|         this.stateService.blocks$.pipe( | ||||
|           skip(1), | ||||
|           throttleTime(40000), | ||||
|           delay(2000), | ||||
|           switchMap(() => this.apiService.federationAuditSynced$()), | ||||
|           share() | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user