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

stop and start syncing

This commit is contained in:
Kyle Spearrin
2018-05-03 12:27:30 -04:00
parent fef65c5209
commit fd3793d3d7
6 changed files with 97 additions and 12 deletions

View File

@@ -7,7 +7,7 @@ import { WindowMain } from 'jslib/electron/window.main';
import { MenuMain } from './menu.main';
const SyncInterval = 5 * 60 * 1000; // 5 minutes
const SyncCheckInterval = 60 * 1000; // 1 minute
export class MessagingMain {
private syncTimeout: NodeJS.Timer;
@@ -21,9 +21,14 @@ export class MessagingMain {
onMessage(message: any) {
switch (message.command) {
case 'scheduleNextSync':
case 'scheduleNextDirSync':
this.scheduleNextSync();
break;
case 'cancelDirSync':
if (this.syncTimeout) {
global.clearTimeout(this.syncTimeout);
}
break;
default:
break;
}
@@ -40,8 +45,8 @@ export class MessagingMain {
}
this.windowMain.win.webContents.send('messagingService', {
command: 'checkSyncVault',
command: 'checkDirSync',
});
}, SyncInterval);
}, SyncCheckInterval);
}
}