File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,6 @@ async function healthCheck(req: Request, res: Response) {
2626 metadataHealthCheck ( ) ,
2727 ] )
2828
29- const blockLastTimeStamp = cardanoNodeStatus . lastTimeStamp
30- const secsSinceLastBlock = blockLastTimeStamp ? new Date ( Date . now ( ) - blockLastTimeStamp ) . getSeconds ( ) : null
31-
3229 const isHealthy =
3330 isKafkaHealthy &&
3431 nodeStatus . isHealthy &&
@@ -45,8 +42,8 @@ async function healthCheck(req: Request, res: Response) {
4542 } ,
4643 cardanoNode : {
4744 isHealthy : nodeStatus . isHealthy ,
48- secsSinceLastBlock,
49- lastBlockTime : blockLastTimeStamp ? new Date ( blockLastTimeStamp ) . toLocaleTimeString ( ) : null ,
45+ secsSinceLastBlock : nodeStatus . secsSinceLastBlock ,
46+ lastBlockTime : new Date ( nodeStatus . lastBlockTimeStamp ) . toLocaleTimeString ( ) ,
5047 lastBlock : nodeStatus . block ,
5148 } ,
5249 dbSync : {
Original file line number Diff line number Diff line change @@ -20,7 +20,14 @@ class CardanoNodeStatus {
2020 }
2121
2222 checkStatus ( ) {
23- return { isHealthy : Date . now ( ) - this . lastTimeStamp < 6 * 60 * 1000 , block : this . block }
23+ const currentTimeStamp = Date . now ( )
24+ const secsSinceLastBlock = currentTimeStamp - this . lastTimeStamp
25+ return {
26+ isHealthy : secsSinceLastBlock < 6 * 60 * 1000 ,
27+ block : this . block ,
28+ secsSinceLastBlock : Math . floor ( secsSinceLastBlock / 1000 ) ,
29+ lastBlockTimeStamp : this . lastTimeStamp ,
30+ }
2431 }
2532}
2633
You can’t perform that action at this time.
0 commit comments