Set backend to out of sync after connection retry interval has exceeded.
This commit is contained in:
		
							parent
							
								
									a158794e2c
								
							
						
					
					
						commit
						9900f4da80
					
				| @ -29,10 +29,15 @@ class Mempool { | ||||
|     setInterval(this.updateTxPerSecond.bind(this), 1000); | ||||
|   } | ||||
| 
 | ||||
|   public isInSync() { | ||||
|   public isInSync(): boolean { | ||||
|     return this.inSync; | ||||
|   } | ||||
| 
 | ||||
|   public setOutOfSync(): void { | ||||
|     this.inSync = false; | ||||
|     loadingIndicators.setProgress('mempool', 99); | ||||
|   } | ||||
| 
 | ||||
|   public getLatestTransactions() { | ||||
|     return this.latestTransactions; | ||||
|   } | ||||
|  | ||||
| @ -21,6 +21,7 @@ import donations from './api/donations'; | ||||
| import logger from './logger'; | ||||
| import backendInfo from './api/backend-info'; | ||||
| import loadingIndicators from './api/loading-indicators'; | ||||
| import mempool from './api/mempool'; | ||||
| 
 | ||||
| class Server { | ||||
|   private wss: WebSocket.Server | undefined; | ||||
| @ -120,6 +121,7 @@ class Server { | ||||
|       const loggerMsg = `runMainLoop error: ${(e.message || e)}. Retrying in ${this.currentBackendRetryInterval} sec.`; | ||||
|       if (this.currentBackendRetryInterval > 5) { | ||||
|         logger.warn(loggerMsg); | ||||
|         mempool.setOutOfSync(); | ||||
|       } else { | ||||
|         logger.debug(loggerMsg); | ||||
|       } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user