MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / triggerLost

Function triggerLost

packages/internal/src/db/advisory-lock.ts:94–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92 let healthCheckInFlight = false // Guard against stacking health checks
93
94 const triggerLost = () => {
95 if (isReleased || lostTriggered) return
96 lostTriggered = true
97 logLock('warn', 'Lock lost detected, triggering lost callback', { lockId, healthCheckCount })
98 if (healthCheckTimer) {
99 clearInterval(healthCheckTimer)
100 healthCheckTimer = null
101 }
102 // Close the connection before marking as released
103 connection.end().catch(() => {})
104 isReleased = true
105 if (lostCallback) {
106 lostCallback()
107 }
108 }
109
110 // Start health check interval - verify we still hold the lock, not just connection liveness
111 healthCheckTimer = setInterval(async () => {

Callers 1

tryAcquireAdvisoryLockFunction · 0.85

Calls 1

logLockFunction · 0.85

Tested by

no test coverage detected