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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user