MCPcopy Create free account
hub / github.com/CodeFox-Repo/codefox / checkProjectStatus

Function checkProjectStatus

frontend/src/hooks/useProjectStatusMonitor.ts:46–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44 useEffect(() => {
45 if (!chatId) return;
46
47 // eslint-disable-next-line prefer-const
48 let pollingInterval: NodeJS.Timeout;
49 let attemptCount = 0;
50 const MAX_ATTEMPTS = 60; // About 2 minutes of polling
51
52 const checkProjectStatus = async () => {
53 attemptCount++;
54
55 try {
56 await getChatDetails({
57 variables: { chatId },
58 });
59 } catch (err) {
60 logger.error('Error polling for project:', err);
61 }
62
63 // Stop polling if project is ready or max attempts reached
64 if (isReady || attemptCount >= MAX_ATTEMPTS) {
65 clearInterval(pollingInterval);
66
67 if (attemptCount >= MAX_ATTEMPTS && !isReady) {
68 setError(
69 'Project creation is taking longer than expected. Please check back later.'
70 );

Callers 1

useProjectStatusMonitorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected