diff --git a/peerprep-fe/src/app/collaboration/components/AudioSharing.tsx b/peerprep-fe/src/app/collaboration/components/AudioSharing.tsx index 3316308e5d..76c7954e69 100644 --- a/peerprep-fe/src/app/collaboration/components/AudioSharing.tsx +++ b/peerprep-fe/src/app/collaboration/components/AudioSharing.tsx @@ -109,7 +109,10 @@ const AudioSharing = () => { peer.on('error', (err: Error) => { console.error('Peer connection error:', err); - cleanupAudio(true); + setTimeout(() => { + cleanupAudio(true); + createPeer(stream, initiator); // Recreate the peer + }, 2000); }); peer.on('close', () => { diff --git a/peerprep-fe/src/app/collaboration/components/CollaborationEditor.tsx b/peerprep-fe/src/app/collaboration/components/CollaborationEditor.tsx index aa102cd543..2b6e569ff2 100644 --- a/peerprep-fe/src/app/collaboration/components/CollaborationEditor.tsx +++ b/peerprep-fe/src/app/collaboration/components/CollaborationEditor.tsx @@ -127,7 +127,7 @@ const CollaborationEditor = ({ matchId }: CollaborationEditorProps) => { prevClientsRef.current = newClients; setConnectedClients(newClients); } - }, 1000); // Debounce for 1 second + }, 5000); // Debounce for 1 second }; const handleEditorMount = (editor: MonacoEditor.IStandaloneCodeEditor) => { @@ -181,7 +181,7 @@ const CollaborationEditor = ({ matchId }: CollaborationEditorProps) => { if (providerRef.current?.wsconnected) { updateLocalAwareness(); } - }, 30000); // Refresh every 30 seconds + }, 5000); return () => { clearInterval(refreshInterval);