MCPcopy Create free account
hub / github.com/Microck/opencode-studio / pollHealth

Function pollHealth

client-next/src/lib/context.tsx:153–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151 };
152
153 const pollHealth = async () => {
154 try {
155 const isHealthy = await checkHealth();
156 if (isHealthy) {
157 if (!connected) {
158 setConnected(true);
159 checkServerVersion();
160 checkAutoSync();
161 refreshData();
162 checkForPendingAction();
163 }
164 } else {
165 if (connected) {
166 setConnected(false);
167 setError('Backend disconnected. Attempting to reconnect...');
168 checkedPendingRef.current = false;
169 }
170 }
171 } catch {
172 if (connected) {
173 setConnected(false);
174 setError('Backend connection lost. Check if the server is still running.');
175 }
176 }
177 };
178
179 checkServerVersion();
180 checkAutoSync();

Callers

nothing calls this directly

Calls 3

checkHealthFunction · 0.90
checkServerVersionFunction · 0.85
checkAutoSyncFunction · 0.85

Tested by

no test coverage detected