@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.
@@ -44,14 +44,26 @@ export class DocumentsSynchronizer extends Resource {
44
44
  super();
45
45
  }
46
46
 
47
- async addDocuments(documentIds: DocumentId[]) {
47
+ addDocuments(documentIds: DocumentId[], retryCounter = 0) {
48
+ if (retryCounter > 3) {
49
+ log.warn('Failed to load document, retry limit reached', { documentIds });
50
+ return;
51
+ }
52
+
48
53
  for (const documentId of documentIds) {
49
54
  const doc = this._params.repo.find(documentId as DocumentId);
50
- await doc.whenReady();
51
- this._startSync(doc);
52
- this._pendingUpdates.add(doc.documentId);
55
+ doc
56
+ .whenReady()
57
+ .then(() => {
58
+ this._startSync(doc);
59
+ this._pendingUpdates.add(doc.documentId);
60
+ this._sendUpdatesJob!.trigger();
61
+ })
62
+ .catch((error) => {
63
+ log.warn('Failed to load document, wraparound', { documentId, error });
64
+ this.addDocuments([documentId], retryCounter + 1);
65
+ });
53
66
  }
54
- this._sendUpdatesJob!.trigger();
55
67
  }
56
68
 
57
69
  removeDocuments(documentIds: DocumentId[]) {
@@ -150,7 +150,7 @@ export class MetadataStore {
150
150
 
151
151
  // post-processing
152
152
  this._metadata.spaces?.forEach((space) => {
153
- space.state ??= SpaceState.ACTIVE;
153
+ space.state ??= SpaceState.SPACE_ACTIVE;
154
154
  });
155
155
  } catch (err: any) {
156
156
  log.error('failed to load metadata', { err });