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

Function startRestartInterval

src/services/preventSleep.ts:70–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68}
69
70function startRestartInterval(): void {
71 // Only run on macOS
72 if (process.platform !== 'darwin') {
73 return
74 }
75
76 // Already running
77 if (restartInterval !== null) {
78 return
79 }
80
81 restartInterval = setInterval(() => {
82 // Only restart if we still need sleep prevention
83 if (refCount > 0) {
84 logForDebugging('Restarting caffeinate to maintain sleep prevention')
85 killCaffeinate()
86 spawnCaffeinate()
87 }
88 }, RESTART_INTERVAL_MS)
89
90 // Don't let the interval keep the Node process alive
91 restartInterval.unref()
92}
93
94function stopRestartInterval(): void {
95 if (restartInterval !== null) {

Callers 1

startPreventSleepFunction · 0.85

Calls 3

logForDebuggingFunction · 0.85
killCaffeinateFunction · 0.85
spawnCaffeinateFunction · 0.85

Tested by

no test coverage detected