Avoid duplicate fullSync api calls (#716)

This commit is contained in:
Thomas Rittson 2022-03-11 07:16:50 +10:00 committed by GitHub
parent f7375e9064
commit 3f20122e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import { SendService } from "../abstractions/send.service";
import { SettingsService } from "../abstractions/settings.service"; import { SettingsService } from "../abstractions/settings.service";
import { StateService } from "../abstractions/state.service"; import { StateService } from "../abstractions/state.service";
import { SyncService as SyncServiceAbstraction } from "../abstractions/sync.service"; import { SyncService as SyncServiceAbstraction } from "../abstractions/sync.service";
import { sequentialize } from "../misc/sequentialize";
import { CipherData } from "../models/data/cipherData"; import { CipherData } from "../models/data/cipherData";
import { CollectionData } from "../models/data/collectionData"; import { CollectionData } from "../models/data/collectionData";
import { FolderData } from "../models/data/folderData"; import { FolderData } from "../models/data/folderData";
@ -71,6 +72,7 @@ export class SyncService implements SyncServiceAbstraction {
await this.stateService.setLastSync(date.toJSON(), { userId: userId }); await this.stateService.setLastSync(date.toJSON(), { userId: userId });
} }
@sequentialize(() => "fullSync")
async fullSync(forceSync: boolean, allowThrowOnError = false): Promise<boolean> { async fullSync(forceSync: boolean, allowThrowOnError = false): Promise<boolean> {
this.syncStarted(); this.syncStarted();
const isAuthenticated = await this.stateService.getIsAuthenticated(); const isAuthenticated = await this.stateService.getIsAuthenticated();