@xtr-dev/rondevu-client 0.18.2 → 0.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rondevu.d.ts CHANGED
@@ -176,6 +176,7 @@ export declare class Rondevu extends EventEmitter {
176
176
  private filling;
177
177
  private pollingInterval;
178
178
  private lastPollTimestamp;
179
+ private isPolling;
179
180
  private constructor();
180
181
  /**
181
182
  * Internal debug logging - only logs if debug mode is enabled
package/dist/rondevu.js CHANGED
@@ -153,6 +153,7 @@ export class Rondevu extends EventEmitter {
153
153
  this.filling = false;
154
154
  this.pollingInterval = null;
155
155
  this.lastPollTimestamp = 0;
156
+ this.isPolling = false; // Guard against concurrent poll execution
156
157
  this.apiUrl = apiUrl;
157
158
  this.username = username;
158
159
  this.keypair = keypair;
@@ -456,6 +457,12 @@ export class Rondevu extends EventEmitter {
456
457
  async pollInternal() {
457
458
  if (!this.filling)
458
459
  return;
460
+ // Prevent concurrent poll execution to avoid duplicate answer processing
461
+ if (this.isPolling) {
462
+ this.debug('Poll already in progress, skipping');
463
+ return;
464
+ }
465
+ this.isPolling = true;
459
466
  try {
460
467
  const result = await this.api.poll(this.lastPollTimestamp);
461
468
  // Process answers
@@ -492,6 +499,9 @@ export class Rondevu extends EventEmitter {
492
499
  catch (err) {
493
500
  console.error('[Rondevu] Polling error:', err);
494
501
  }
502
+ finally {
503
+ this.isPolling = false;
504
+ }
495
505
  }
496
506
  /**
497
507
  * Start filling offers and polling for answers/ICE
@@ -521,6 +531,7 @@ export class Rondevu extends EventEmitter {
521
531
  stopFilling() {
522
532
  this.debug('Stopping offer filling and polling');
523
533
  this.filling = false;
534
+ this.isPolling = false; // Reset polling guard
524
535
  // Stop polling
525
536
  if (this.pollingInterval) {
526
537
  clearInterval(this.pollingInterval);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtr-dev/rondevu-client",
3
- "version": "0.18.2",
3
+ "version": "0.18.3",
4
4
  "description": "TypeScript client for Rondevu with durable WebRTC connections, automatic reconnection, and message queuing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",