Skip to content

Commit

Permalink
Added debug logging to consumer.heartbeat to see if it goes missing
Browse files Browse the repository at this point in the history
  • Loading branch information
tysseng committed Nov 9, 2023
1 parent c220655 commit d6d209e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/monitoring.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import logger from './logger.js'

const MINUTE = 60000
const threshold = 3 * MINUTE
let lastHeartbeat = Date.now()
export const updateLastHeartbeat = (): void => {
lastHeartbeat = Date.now()
logger.debug('consumer.heartbeat received', { lastHeartbeat })
}

export const isHeartBeating = (): boolean => Date.now() - lastHeartbeat < threshold
Expand Down

0 comments on commit d6d209e

Please sign in to comment.