MCPcopy Index your code
hub / github.com/codeaashu/claude-code / startHeartbeat

Method startHeartbeat

src/cli/transports/ccrClient.ts:678–695  ·  view source on GitHub ↗

Start periodic heartbeat.

()

Source from the content-addressed store, hash-verified

676
677 /** Start periodic heartbeat. */
678 private startHeartbeat(): void {
679 this.stopHeartbeat()
680 const schedule = (): void => {
681 const jitter =
682 this.heartbeatIntervalMs *
683 this.heartbeatJitterFraction *
684 (2 * Math.random() - 1)
685 this.heartbeatTimer = setTimeout(tick, this.heartbeatIntervalMs + jitter)
686 }
687 const tick = (): void => {
688 void this.sendHeartbeat()
689 // stopHeartbeat nulls the timer; check after the fire-and-forget send
690 // but before rescheduling so close() during sendHeartbeat is honored.
691 if (this.heartbeatTimer === null) return
692 schedule()
693 }
694 schedule()
695 }
696
697 /** Stop heartbeat timer. */
698 private stopHeartbeat(): void {

Callers 1

initializeMethod · 0.95

Calls 2

stopHeartbeatMethod · 0.95
scheduleFunction · 0.85

Tested by

no test coverage detected