* Data sending status listener * Regular polling to check whether user data has been sent and confirmed * If it has not been confirmed for a long time (1 minute), execute a retry mechanism * This situation usually occurs with an error
()
| 457 | * This situation usually occurs with an error |
| 458 | */ |
| 459 | private setSendingWatcher() { |
| 460 | this.clearSendingWatcher(); |
| 461 | this.sendingWatcherTimer = setInterval(() => { |
| 462 | if (!this.isConnect()) { |
| 463 | return; |
| 464 | } |
| 465 | const changesets: ILocalChangeset[] = []; |
| 466 | for (const key of this.collaEngineMap.keys()) { |
| 467 | const localChangeset = this.collaEngineMap.get(key)!.bufferStorage.localPendingChangeset; |
| 468 | |
| 469 | if (localChangeset) { |
| 470 | changesets.push(localChangeset); |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | if (changesets.length > 0 && Date.now() - this.event.getRoomLastSendTime()! > 60 * 1000) { |
| 475 | this.forceSend(changesets); |
| 476 | } |
| 477 | }, 10 * 1000); |
| 478 | } |
| 479 | |
| 480 | private clearSendingWatcher() { |
| 481 | clearInterval(this.sendingWatcherTimer); |