mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-08-10 09:48:40 +00:00
comment setError(true); when attemptReconnect
This commit is contained in:
@ -256,12 +256,14 @@ const useSocket = (
|
|||||||
});
|
});
|
||||||
|
|
||||||
ws.onerror = () => {
|
ws.onerror = () => {
|
||||||
|
debugger
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
setIsWSReady(false);
|
setIsWSReady(false);
|
||||||
toast.error('WebSocket connection error.');
|
toast.error('WebSocket connection error.');
|
||||||
};
|
};
|
||||||
|
|
||||||
ws.onclose = () => {
|
ws.onclose = () => {
|
||||||
|
debugger
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
setIsWSReady(false);
|
setIsWSReady(false);
|
||||||
console.debug(new Date(), 'ws:disconnected');
|
console.debug(new Date(), 'ws:disconnected');
|
||||||
@ -277,15 +279,17 @@ const useSocket = (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const attemptReconnect = () => {
|
const attemptReconnect = async () => {
|
||||||
retryCountRef.current += 1;
|
retryCountRef.current += 1;
|
||||||
|
|
||||||
if (retryCountRef.current > MAX_RETRIES) {
|
if (retryCountRef.current > MAX_RETRIES) {
|
||||||
console.debug(new Date(), 'ws:max_retries');
|
console.debug(new Date(), 'ws:max_retries');
|
||||||
setError(true);
|
//setError(true);
|
||||||
|
|
||||||
toast.error(
|
toast.error(
|
||||||
'Unable to connect to server after multiple attempts. Please refresh the page to try again.',
|
'Unable to connect to server after multiple attempts. Please refresh the page to try again.',
|
||||||
);
|
);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user