Merge pull request #3487 from mempool/simon/catch-unhandled-lnd-axios-request
Catch exeptions in Lightning stats
This commit is contained in:
		
						commit
						493ea0641d
					
				| @ -215,11 +215,11 @@ class Server { | |||||||
|       await lightningStatsUpdater.$startService(); |       await lightningStatsUpdater.$startService(); | ||||||
|       await forensicsService.$startService(); |       await forensicsService.$startService(); | ||||||
|     } catch(e) { |     } catch(e) { | ||||||
|       logger.err(`Nodejs lightning backend crashed. Restarting in 1 minute. Reason: ${(e instanceof Error ? e.message : e)}`); |       logger.err(`Exception in $runLightningBackend. Restarting in 1 minute. Reason: ${(e instanceof Error ? e.message : e)}`); | ||||||
|       await Common.sleep$(1000 * 60); |       await Common.sleep$(1000 * 60); | ||||||
|       this.$runLightningBackend(); |       this.$runLightningBackend(); | ||||||
|     }; |     }; | ||||||
| } |   } | ||||||
| 
 | 
 | ||||||
|   setUpWebsocketHandling(): void { |   setUpWebsocketHandling(): void { | ||||||
|     if (this.wss) { |     if (this.wss) { | ||||||
|  | |||||||
| @ -22,12 +22,15 @@ class LightningStatsUpdater { | |||||||
|    * Update the latest entry for each node every config.LIGHTNING.STATS_REFRESH_INTERVAL seconds |    * Update the latest entry for each node every config.LIGHTNING.STATS_REFRESH_INTERVAL seconds | ||||||
|    */ |    */ | ||||||
|   private async $logStatsDaily(): Promise<void> { |   private async $logStatsDaily(): Promise<void> { | ||||||
|     const date = new Date(); |     try { | ||||||
|     Common.setDateMidnight(date); |       const date = new Date(); | ||||||
|     const networkGraph = await lightningApi.$getNetworkGraph(); |       Common.setDateMidnight(date); | ||||||
|     await LightningStatsImporter.computeNetworkStats(date.getTime() / 1000, networkGraph); |       const networkGraph = await lightningApi.$getNetworkGraph(); | ||||||
|      |       await LightningStatsImporter.computeNetworkStats(date.getTime() / 1000, networkGraph); | ||||||
|     logger.debug(`Updated latest network stats`, logger.tags.ln); |       logger.debug(`Updated latest network stats`, logger.tags.ln); | ||||||
|  |     } catch (e) { | ||||||
|  |       logger.err(`Exception in $logStatsDaily. Reason: ${(e instanceof Error ? e.message : e)}`); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user