Improve deferred mempool visualization updates
This commit is contained in:
		
							parent
							
								
									8ec5dd70e0
								
							
						
					
					
						commit
						56a0d89b88
					
				| @ -238,7 +238,7 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // collates non-urgent updates into a set of consistent pending changes
 |   // collates deferred updates into a set of consistent pending changes
 | ||||||
|   queueUpdate(add: TransactionStripped[], remove: string[], change: { txid: string, rate: number | undefined, acc: boolean | undefined }[], direction: string = 'left'): void { |   queueUpdate(add: TransactionStripped[], remove: string[], change: { txid: string, rate: number | undefined, acc: boolean | undefined }[], direction: string = 'left'): void { | ||||||
|     for (const tx of add) { |     for (const tx of add) { | ||||||
|       this.pendingUpdate.add[tx.txid] = tx; |       this.pendingUpdate.add[tx.txid] = tx; | ||||||
| @ -262,9 +262,15 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On | |||||||
|     this.pendingUpdate.count++; |     this.pendingUpdate.count++; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   deferredUpdate(add: TransactionStripped[], remove: string[], change: { txid: string, rate: number | undefined, acc: boolean | undefined }[], direction: string = 'left'): void { | ||||||
|  |     this.queueUpdate(add, remove, change, direction); | ||||||
|  |     this.applyQueuedUpdates(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   applyQueuedUpdates(): void { |   applyQueuedUpdates(): void { | ||||||
|     if (this.pendingUpdate.count && performance.now() > (this.lastUpdate + this.animationDuration)) { |     if (this.pendingUpdate.count && performance.now() > (this.lastUpdate + this.animationDuration)) { | ||||||
|       this.update([], [], [], this.pendingUpdate?.direction); |       this.applyUpdate(Object.values(this.pendingUpdate.add), Object.values(this.pendingUpdate.remove), Object.values(this.pendingUpdate.change), this.pendingUpdate.direction); | ||||||
|  |       this.clearUpdateQueue(); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -144,7 +144,7 @@ export class MempoolBlockOverviewComponent implements OnInit, OnDestroy, OnChang | |||||||
|       if (blockMined) { |       if (blockMined) { | ||||||
|         this.blockGraph.update(delta.added, delta.removed, delta.changed || [], blockMined ? this.chainDirection : this.poolDirection, blockMined); |         this.blockGraph.update(delta.added, delta.removed, delta.changed || [], blockMined ? this.chainDirection : this.poolDirection, blockMined); | ||||||
|       } else { |       } else { | ||||||
|         this.blockGraph.queueUpdate(delta.added, delta.removed, delta.changed || [], this.poolDirection); |         this.blockGraph.deferredUpdate(delta.added, delta.removed, delta.changed || [], this.poolDirection); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user