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