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

Function startPoll

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

Source from the content-addressed store, hash-verified

253 }
254
255 function startPoll(engine: Host, pinned: Backend.Backend) {
256 const readHeadKey = () => pinned.headKeyOf().catch(() => '')
257
258 if (polled.toplevel === pinned.repository.toplevel) {
259 return
260 }
261
262 timers.get('poll')?.cancel()
263 polled.toplevel = pinned.repository.toplevel
264 polled.headKey = ''
265
266 timers.set(
267 'poll',
268 engine.every(Limits.HEAD_POLL_MS, () => {
269 if (!isPaneOpen) {
270 return
271 }
272
273 void readHeadKey().then(key => {
274 const hasMoved = polled.headKey !== '' && key !== polled.headKey
275
276 polled.headKey = key
277
278 if (hasMoved) {
279 scheduleRefresh(engine)
280 }
281 })
282 }),
283 )
284 }
285
286 async function refresh(engine: Host): Promise<void> {
287 if (isRefreshing) {

Callers 1

refreshFunction · 0.85

Calls 4

readHeadKeyFunction · 0.85
scheduleRefreshFunction · 0.85
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected