Merge pull request #3967 from mempool/nymkappa/update-price-timestamp-websocket
[price updater] update latestPrices timestamp before pushing to websocket
This commit is contained in:
		
						commit
						a52d5faf4f
					
				| @ -153,6 +153,7 @@ class PriceUpdater { | |||||||
|       try { |       try { | ||||||
|         const p = 60 * 60 * 1000; // milliseconds in an hour
 |         const p = 60 * 60 * 1000; // milliseconds in an hour
 | ||||||
|         const nowRounded = new Date(Math.round(new Date().getTime() / p) * p); // https://stackoverflow.com/a/28037042
 |         const nowRounded = new Date(Math.round(new Date().getTime() / p) * p); // https://stackoverflow.com/a/28037042
 | ||||||
|  |         this.latestPrices.time = nowRounded.getTime() / 1000; | ||||||
|         await PricesRepository.$savePrices(nowRounded.getTime() / 1000, this.latestPrices); |         await PricesRepository.$savePrices(nowRounded.getTime() / 1000, this.latestPrices); | ||||||
|       } catch (e) { |       } catch (e) { | ||||||
|         this.lastRun = previousRun + 5 * 60; |         this.lastRun = previousRun + 5 * 60; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user