MCPcopy Create free account
hub / github.com/coder/coder / scheduleFire

Method scheduleFire

agent/x/agentmcp/configwatcher.go:328–345  ·  view source on GitHub ↗

scheduleFire arms or extends a single debounce timer.

()

Source from the content-addressed store, hash-verified

326
327// scheduleFire arms or extends a single debounce timer.
328func (cw *configWatcher) scheduleFire() {
329 cw.mu.Lock()
330 defer cw.mu.Unlock()
331 if cw.closed {
332 return
333 }
334 if cw.timer != nil {
335 // Reset existing timer to extend the debounce window.
336 // Stop reports whether the call stopped the timer before
337 // it fired; if so we owe a Done because Add was called
338 // when the timer was created.
339 if cw.timer.Stop() {
340 cw.firesWG.Done()
341 }
342 }
343 cw.firesWG.Add(1)
344 cw.timer = cw.clock.AfterFunc(cw.debounce, cw.fire, "agentmcp", "watch_debounce")
345}
346
347// fire is called once per debounce window. It invokes onChange
348// outside the lock so reload code can re-enter Sync safely.

Callers 2

handleEventMethod · 0.95

Calls 5

StopMethod · 0.65
AddMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
DoneMethod · 0.45

Tested by 1