MCPcopy Create free account
hub / github.com/anthropics/claude-code / startPoll

Function startPoll

mods/diff/hooks/register.ts:319–352  ·  view source on GitHub ↗
(engine: Host, pinned: Backend.Backend)

Source from the content-addressed store, hash-verified

317 }
318
319 function startPoll(engine: Host, pinned: Backend.Backend) {
320 const readHeadKey = () => pinned.headKeyOf().catch(() => '')
321
322 if (polled.toplevel === pinned.repository.toplevel) {
323 return
324 }
325
326 timers.get('poll')?.cancel()
327 polled.toplevel = pinned.repository.toplevel
328 polled.headKey = ''
329
330 timers.set(
331 'poll',
332 engine.every(Limits.HEAD_POLL_MS, () => {
333 if (!isPaneSeen()) {
334 return
335 }
336
337 if (isRefreshQueued && !isRefreshing) {
338 void endOverdueRest(engine)
339 }
340
341 void readHeadKey().then(key => {
342 const hasMoved = polled.headKey !== '' && key !== polled.headKey
343
344 polled.headKey = key
345
346 if (hasMoved) {
347 scheduleRefresh(engine)
348 }
349 })
350 }),
351 )
352 }
353
354 /**
355 * One read of the diff, covering every change seen before it starts. A call

Callers 1

probeBackendFunction · 0.85

Calls 6

isPaneSeenFunction · 0.85
endOverdueRestFunction · 0.85
readHeadKeyFunction · 0.85
scheduleRefreshFunction · 0.85
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected