@dxos/echo-pipeline 0.6.3-main.9e4e207 → 0.6.3-main.a95c491

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.
@@ -137,14 +137,39 @@ var DocumentsSynchronizer = class extends Resource {
137
137
  this._pendingUpdates = /* @__PURE__ */ new Set();
138
138
  this._sendUpdatesJob = void 0;
139
139
  }
140
- async addDocuments(documentIds) {
140
+ addDocuments(documentIds, retryCounter = 0) {
141
+ if (retryCounter > 3) {
142
+ log.warn("Failed to load document, retry limit reached", {
143
+ documentIds
144
+ }, {
145
+ F: __dxlog_file2,
146
+ L: 49,
147
+ S: this,
148
+ C: (f, a) => f(...a)
149
+ });
150
+ return;
151
+ }
141
152
  for (const documentId of documentIds) {
142
153
  const doc = this._params.repo.find(documentId);
143
- await doc.whenReady();
144
- this._startSync(doc);
145
- this._pendingUpdates.add(doc.documentId);
154
+ doc.whenReady().then(() => {
155
+ this._startSync(doc);
156
+ this._pendingUpdates.add(doc.documentId);
157
+ this._sendUpdatesJob.trigger();
158
+ }).catch((error) => {
159
+ log.warn("Failed to load document, wraparound", {
160
+ documentId,
161
+ error
162
+ }, {
163
+ F: __dxlog_file2,
164
+ L: 63,
165
+ S: this,
166
+ C: (f, a) => f(...a)
167
+ });
168
+ this.addDocuments([
169
+ documentId
170
+ ], retryCounter + 1);
171
+ });
146
172
  }
147
- this._sendUpdatesJob.trigger();
148
173
  }
149
174
  removeDocuments(documentIds) {
150
175
  for (const documentId of documentIds) {
@@ -179,7 +204,7 @@ var DocumentsSynchronizer = class extends Resource {
179
204
  documentId: doc.documentId
180
205
  }, {
181
206
  F: __dxlog_file2,
182
- L: 90,
207
+ L: 102,
183
208
  S: this,
184
209
  C: (f, a) => f(...a)
185
210
  });
@@ -222,7 +247,7 @@ var DocumentsSynchronizer = class extends Resource {
222
247
  const syncState = this._syncStates.get(documentId);
223
248
  invariant2(syncState, "Sync state for document not found", {
224
249
  F: __dxlog_file2,
225
- L: 131,
250
+ L: 143,
226
251
  S: this,
227
252
  A: [
228
253
  "syncState",
@@ -244,7 +269,7 @@ var DocumentsSynchronizer = class extends Resource {
244
269
  const syncState = this._syncStates.get(documentId);
245
270
  invariant2(syncState, "Sync state for document not found", {
246
271
  F: __dxlog_file2,
247
- L: 146,
272
+ L: 158,
248
273
  S: this,
249
274
  A: [
250
275
  "syncState",
@@ -1024,7 +1049,7 @@ var AutomergeHost = class extends Resource4 {
1024
1049
  await waitForHeads(handle, entry.heads);
1025
1050
  }));
1026
1051
  }
1027
- await this._repo.flush(heads.entries?.map((entry) => entry.documentId) ?? []);
1052
+ await this._repo.flush(documentIds.filter((documentId) => !!this._repo.handles[documentId]));
1028
1053
  }
1029
1054
  async reIndexHeads(documentIds) {
1030
1055
  for (const documentId of documentIds) {
@@ -3595,7 +3620,7 @@ var MetadataStore = class {
3595
3620
  this._metadata = metadata;
3596
3621
  }
3597
3622
  this._metadata.spaces?.forEach((space) => {
3598
- space.state ??= SpaceState.ACTIVE;
3623
+ space.state ??= SpaceState.SPACE_ACTIVE;
3599
3624
  });
3600
3625
  } catch (err) {
3601
3626
  log15.error("failed to load metadata", {
@@ -3841,4 +3866,4 @@ export {
3841
3866
  MetadataStore,
3842
3867
  hasInvitationExpired
3843
3868
  };
3844
- //# sourceMappingURL=chunk-PEE7MYCZ.mjs.map
3869
+ //# sourceMappingURL=chunk-6MJEONOX.mjs.map