mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-02 08:30:14 +01:00
smarter sync polling
This commit is contained in:
parent
f0ff5760d7
commit
214ec930c3
@ -253,9 +253,17 @@ function copyToClipboard(text) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fullSync();
|
// Sync polling
|
||||||
setInterval(fullSync, 6 * 60 * 1000);
|
|
||||||
|
|
||||||
function fullSync() {
|
fullSync(true);
|
||||||
syncService.fullSync(function() {});
|
setInterval(fullSync, 5 * 60 * 1000); // check every 5 minutes
|
||||||
|
var syncInternal = 6 * 60 * 60 * 1000; // 6 hours
|
||||||
|
|
||||||
|
function fullSync(override) {
|
||||||
|
syncService.getLastSync(function (lastSync) {
|
||||||
|
var now = new Date();
|
||||||
|
if (override || !lastSync || (now - lastSync) >= syncInternal) {
|
||||||
|
syncService.fullSync(function () { });
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user