1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

[PM-13422] Fix sync time (#16603)

Do not update the "last sync time" when an error occurs during the sync process, including a network error when retrieving the account's revision date/time from the server. Update the sync time when a sync fires automatically, or when forced, in order to make it clear to the user that the extension's data is current.
This commit is contained in:
Derek Nance
2025-09-30 15:54:04 -05:00
committed by GitHub
parent 0bd098dd8f
commit babbc2b1b6
2 changed files with 100 additions and 1 deletions

View File

@@ -134,9 +134,11 @@ export class DefaultSyncService extends CoreSyncService {
const now = new Date();
let needsSync = false;
let needsSyncSucceeded = true;
try {
needsSync = await this.needsSyncing(forceSync);
} catch (e) {
needsSyncSucceeded = false;
if (allowThrowOnError) {
this.syncCompleted(false, userId);
throw e;
@@ -144,7 +146,9 @@ export class DefaultSyncService extends CoreSyncService {
}
if (!needsSync) {
await this.setLastSync(now, userId);
if (needsSyncSucceeded) {
await this.setLastSync(now, userId);
}
return this.syncCompleted(false, userId);
}