MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / scheduleProbe

Method scheduleProbe

src/ui-server/api/events.ts:408–421  ·  view source on GitHub ↗

* Wait for the writing to stop, then look once. * * Re-armed by every write, so a sync that takes four seconds produces one * probe at its end — except that INDEX_SETTLE_MAX_MS caps how long * the first probe can be deferred, so a continuously-writing full index still * refres

()

Source from the content-addressed store, hash-verified

406 * refreshes the viewer while it runs.
407 */
408 private scheduleProbe(): void {
409 if (this.closed) return;
410 const now = Date.now();
411 if (this.indexPendingSince === 0) this.indexPendingSince = now;
412 const remaining = Math.max(0, this.indexPendingSince + INDEX_SETTLE_MAX_MS - now);
413 if (this.indexTimer) clearTimeout(this.indexTimer);
414 const timer = setTimeout(() => {
415 this.indexTimer = null;
416 this.indexPendingSince = 0;
417 this.checkIndex();
418 }, Math.min(INDEX_SETTLE_MS, remaining));
419 timer.unref?.();
420 this.indexTimer = timer;
421 }
422
423 /** One query. An unmoved revision is not an event. */
424 private checkIndex(): void {

Callers 1

startIndexWatcherMethod · 0.95

Calls 1

checkIndexMethod · 0.95

Tested by

no test coverage detected