@shaxpir/duiduidui-models 1.25.9 → 1.25.11
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.
|
@@ -28,21 +28,27 @@ class SharedContent extends Content_1.Content {
|
|
|
28
28
|
async modelUpdated() {
|
|
29
29
|
this.checkDisposed("SharedContent.modelUpdated");
|
|
30
30
|
this.acquire();
|
|
31
|
+
const contentId = this.id;
|
|
31
32
|
const userIds = this.getAllSharedUserIds();
|
|
32
33
|
for (const userId of userIds) {
|
|
33
34
|
try {
|
|
34
35
|
const manifestId = Manifest_1.Manifest.makeManifestId(userId);
|
|
36
|
+
console.log(`[SharedContent.modelUpdated] acquiring manifest ${manifestId} for content=${contentId}`);
|
|
35
37
|
const manifest = await this.shareSync.acquire(ContentKind_1.ContentKind.MANIFEST, manifestId);
|
|
38
|
+
console.log(`[SharedContent.modelUpdated] acquired manifest ${manifestId} exists=${manifest?.exists()}`);
|
|
36
39
|
if (manifest && manifest.exists()) {
|
|
37
40
|
manifest.update(this);
|
|
38
41
|
manifest.release();
|
|
42
|
+
console.log(`[SharedContent.modelUpdated] updated and released manifest ${manifestId}`);
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
catch (err) {
|
|
46
|
+
console.error(`[SharedContent.modelUpdated] ERROR acquiring manifest for user=${userId}:`, err);
|
|
42
47
|
this.shareSync.onError(err, 'SharedContent.modelUpdated.manifest');
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
this.release();
|
|
51
|
+
console.log(`[SharedContent.modelUpdated] released content=${contentId} acquireCount=${this.acquireCount}`);
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
exports.SharedContent = SharedContent;
|
package/dist/repo/ShareSync.js
CHANGED
|
@@ -389,15 +389,28 @@ class ShareSync {
|
|
|
389
389
|
// First, try getting the content from the cache
|
|
390
390
|
const compoundKey = `${kind}/${id}`;
|
|
391
391
|
if (this._modelCache.has(compoundKey)) {
|
|
392
|
-
|
|
392
|
+
const cached = this._modelCache.get(compoundKey);
|
|
393
|
+
console.log(`[ShareSync.load] cache hit: ${compoundKey} isDisposed=${cached._isDisposed} acquireCount=${cached.acquireCount}`);
|
|
394
|
+
return cached;
|
|
393
395
|
}
|
|
394
396
|
// If not in the cache, get the model doc from the connection.
|
|
395
397
|
// Then wrap it and put it in the cache for future reference.
|
|
396
398
|
const doc = this._connection.get(kind, id);
|
|
397
399
|
if (!doc) {
|
|
398
|
-
console.error(`[ShareSync] connection.get(${kind}, ${id}) returned null/undefined doc`);
|
|
400
|
+
console.error(`[ShareSync.load] connection.get(${kind}, ${id}) returned null/undefined doc`);
|
|
399
401
|
return null;
|
|
400
402
|
}
|
|
403
|
+
const docAny = doc;
|
|
404
|
+
const docState = {
|
|
405
|
+
hasData: typeof doc.data !== 'undefined',
|
|
406
|
+
version: doc.version,
|
|
407
|
+
type: doc.type ? 'set' : 'null',
|
|
408
|
+
wantsDestroy: docAny._wantsDestroy,
|
|
409
|
+
inflightFetch: docAny.inflightFetch?.length,
|
|
410
|
+
pendingFetch: docAny.pendingFetch?.length,
|
|
411
|
+
hasPending: docAny.hasPending?.(),
|
|
412
|
+
};
|
|
413
|
+
console.log(`[ShareSync.load] cache miss: ${compoundKey} doc=${JSON.stringify(docState)}`);
|
|
401
414
|
const model = this.wrap(kind, doc, false);
|
|
402
415
|
this._modelCache.set(compoundKey, model);
|
|
403
416
|
return model;
|