Решение проблемы откатов страницы чтения при нестабильной связи во время синхронизации

This commit is contained in:
Book Pauk
2022-12-15 20:05:03 +07:00
parent 572a5dd200
commit 88f5a98c55
2 changed files with 59 additions and 15 deletions

View File

@@ -49,6 +49,7 @@ class ServerStorage {
this.keyInited = false;
this.commit = this.$store.commit;
this.prevServerStorageKey = null;
this.identity = utils.randomHexString(20);
this.lock = new LockQueue(100);
this.$root.generateNewServerStorageKey = () => {this.generateNewServerStorageKey()};
@@ -647,6 +648,8 @@ class ServerStorage {
await this.setCachedRecentPatch(newRecentPatch);
if (needSaveRecentMod && newRecentMod.rev)
await this.setCachedRecentMod(newRecentMod);
} else {
this.prevItemKey = null;
}
} finally {
this.lock.ret();
@@ -669,7 +672,7 @@ class ServerStorage {
}
async storageApi(action, items, force) {
const request = {action, items};
const request = {action, identity: this.identity, items};
if (force)
request.force = true;
const encodedRequest = await this.encodeStorageItems(request);