@xtr-dev/rondevu-client 0.18.5 → 0.18.6
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.js +7 -2
- package/package.json +1 -1
package/dist/rondevu.js
CHANGED
|
@@ -465,6 +465,11 @@ export class Rondevu extends EventEmitter {
|
|
|
465
465
|
this.isPolling = true;
|
|
466
466
|
try {
|
|
467
467
|
const result = await this.api.poll(this.lastPollTimestamp);
|
|
468
|
+
// Update timestamp FIRST to prevent re-fetching same answers if processing fails
|
|
469
|
+
if (result.answers.length > 0) {
|
|
470
|
+
const maxAnswerTimestamp = Math.max(...result.answers.map(a => a.answeredAt));
|
|
471
|
+
this.lastPollTimestamp = Math.max(this.lastPollTimestamp, maxAnswerTimestamp);
|
|
472
|
+
}
|
|
468
473
|
// Process answers
|
|
469
474
|
for (const answer of result.answers) {
|
|
470
475
|
const activeOffer = this.activeOffers.get(answer.offerId);
|
|
@@ -477,7 +482,6 @@ export class Rondevu extends EventEmitter {
|
|
|
477
482
|
type: 'answer',
|
|
478
483
|
sdp: answer.sdp
|
|
479
484
|
});
|
|
480
|
-
this.lastPollTimestamp = answer.answeredAt;
|
|
481
485
|
this.emit('offer:answered', answer.offerId, answer.answererId);
|
|
482
486
|
// Create replacement offer
|
|
483
487
|
this.fillOffers();
|
|
@@ -485,7 +489,8 @@ export class Rondevu extends EventEmitter {
|
|
|
485
489
|
catch (err) {
|
|
486
490
|
// If setRemoteDescription fails, reset the answered flag
|
|
487
491
|
activeOffer.answered = false;
|
|
488
|
-
|
|
492
|
+
this.debug(`Failed to set remote description for offer ${answer.offerId}:`, err);
|
|
493
|
+
// Don't throw - continue processing other answers
|
|
489
494
|
}
|
|
490
495
|
}
|
|
491
496
|
}
|
package/package.json
CHANGED