mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-18 02:41:15 +02:00
[PM-6426] Setting up the full sync process as an interval rather than a timeout
This commit is contained in:
parent
83cb105b49
commit
daa8916ad6
@ -1053,9 +1053,13 @@ export default class MainBackground {
|
|||||||
if (!this.isPrivateMode) {
|
if (!this.isPrivateMode) {
|
||||||
await this.refreshBadge();
|
await this.refreshBadge();
|
||||||
}
|
}
|
||||||
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
await this.fullSync(true);
|
||||||
this.fullSync(true);
|
await this.taskSchedulerService.setInterval(
|
||||||
|
() => this.fullSync(),
|
||||||
|
5 * 60 * 1000, // check every 5 minutes
|
||||||
|
ScheduledTaskNames.scheduleNextSyncTimeout,
|
||||||
|
);
|
||||||
setTimeout(() => this.notificationsService.init(), 2500);
|
setTimeout(() => this.notificationsService.init(), 2500);
|
||||||
resolve();
|
resolve();
|
||||||
}, 500);
|
}, 500);
|
||||||
@ -1289,18 +1293,5 @@ export default class MainBackground {
|
|||||||
if (override || lastSyncAgo >= syncInternal) {
|
if (override || lastSyncAgo >= syncInternal) {
|
||||||
await this.syncService.fullSync(override);
|
await this.syncService.fullSync(override);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.scheduleNextSync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async scheduleNextSync() {
|
|
||||||
await this.taskSchedulerService.clearScheduledTask({
|
|
||||||
taskName: ScheduledTaskNames.scheduleNextSyncTimeout,
|
|
||||||
});
|
|
||||||
await this.taskSchedulerService.setTimeout(
|
|
||||||
() => this.fullSync(),
|
|
||||||
5 * 60 * 1000, // check every 5 minutes
|
|
||||||
ScheduledTaskNames.scheduleNextSyncTimeout,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user