mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-10 10:53:24 +00:00
Fix: Stop polling when offer expires or connection succeeds
- Stop polling when 404 error (offer not found/expired) - Stop polling once connection state is 'connected' - Prevents unnecessary API calls and console errors - Improves resource cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -132,6 +132,8 @@ export class RondevuConnection {
|
||||
break;
|
||||
case 'connected':
|
||||
this.emit('connected');
|
||||
// Stop polling once connected - we have all the ICE candidates we need
|
||||
this.stopPolling();
|
||||
break;
|
||||
case 'disconnected':
|
||||
case 'failed':
|
||||
@@ -261,6 +263,10 @@ export class RondevuConnection {
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error polling for answers:', err);
|
||||
// Stop polling if offer expired/not found
|
||||
if (err instanceof Error && err.message.includes('not found')) {
|
||||
this.stopPolling();
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
@@ -287,6 +293,10 @@ export class RondevuConnection {
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error polling for ICE candidates:', err);
|
||||
// Stop polling if offer expired/not found
|
||||
if (err instanceof Error && err.message.includes('not found')) {
|
||||
this.stopPolling();
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user