MCPcopy Create free account
hub / github.com/apitable/apitable / setSendingWatcher

Method setSendingWatcher

packages/core/src/sync/room.ts:459–478  ·  view source on GitHub ↗

* 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

()

Source from the content-addressed store, hash-verified

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);

Callers 1

watchMethod · 0.95

Calls 5

clearSendingWatcherMethod · 0.95
forceSendMethod · 0.95
keysMethod · 0.65
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected