Skip to content

Commit ff3254c

Browse files
committed
Trying to fix intermittent connectivity
1 parent b0f812e commit ff3254c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

peerprep-fe/src/app/collaboration/components/AudioSharing.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ const AudioSharing = () => {
109109

110110
peer.on('error', (err: Error) => {
111111
console.error('Peer connection error:', err);
112-
cleanupAudio(true);
112+
setTimeout(() => {
113+
cleanupAudio(true);
114+
createPeer(stream, initiator); // Recreate the peer
115+
}, 2000);
113116
});
114117

115118
peer.on('close', () => {

peerprep-fe/src/app/collaboration/components/CollaborationEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const CollaborationEditor = ({ matchId }: CollaborationEditorProps) => {
127127
prevClientsRef.current = newClients;
128128
setConnectedClients(newClients);
129129
}
130-
}, 1000); // Debounce for 1 second
130+
}, 5000); // Debounce for 1 second
131131
};
132132

133133
const handleEditorMount = (editor: MonacoEditor.IStandaloneCodeEditor) => {
@@ -181,7 +181,7 @@ const CollaborationEditor = ({ matchId }: CollaborationEditorProps) => {
181181
if (providerRef.current?.wsconnected) {
182182
updateLocalAwareness();
183183
}
184-
}, 30000); // Refresh every 30 seconds
184+
}, 5000);
185185

186186
return () => {
187187
clearInterval(refreshInterval);

0 commit comments

Comments
 (0)