MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / poll

Function poll

graph-ui/src/system/useSystemPoll.ts:33–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 clearTimeout(timer);
32 };
33 const poll = async () => {
34 if (disposed || !visible() || inFlight) return;
35 clearTimeout(timer);
36 const ticket = generation;
37 inFlight = true;
38 setReading((previous) => ({ ...previous, loading: true }));
39 try {
40 const data = await read();
41 if (!disposed && ticket === generation && visible()) {
42 setReading({ data, updatedAt: Date.now(), error: null, loading: false });
43 }
44 } catch (error) {
45 if (!disposed && ticket === generation && visible()) {
46 setReading((previous) => ({ ...previous, error: error instanceof Error ? error.message : String(error), loading: false }));
47 }
48 } finally {
49 if (!disposed && ticket === generation) {
50 inFlight = false;
51 if (visible() && !paused) timer = setTimeout(() => { void poll(); }, intervalMs);
52 }
53 }
54 };
55 const visibilityChanged = () => {
56 invalidate();
57 setReading((previous) => ({ ...previous, loading: false }));

Callers 13

visibilityChangedFunction · 0.70
useSystemPollFunction · 0.70
poll_for_input_unixFunction · 0.50
wait_readyFunction · 0.50
poll_untilFunction · 0.50
test_cli.cFile · 0.50
cli_scope_host_childFunction · 0.50
transferFunction · 0.50
lock_registry_pipe_readFunction · 0.50

Calls 3

setReadingFunction · 0.85
visibleFunction · 0.70
readFunction · 0.70

Tested by 5

cli_scope_host_childFunction · 0.40
transferFunction · 0.40
lock_registry_pipe_readFunction · 0.40
transferFunction · 0.40