Skip to content

Commit 3aba6f7

Browse files
committed
run sync every 500 ms
1 parent 0916449 commit 3aba6f7

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/vs/workbench/contrib/userData/browser/userData.contribution.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { registerAndGetAmdImageURL } from 'vs/base/common/amd';
2323
import { ResourceContextKey } from 'vs/workbench/common/resources';
2424
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
2525
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
26+
import { Event } from 'vs/base/common/event';
2627

2728
const CONTEXT_SYNC_STATE = new RawContextKey<string>('syncStatus', SyncStatus.Uninitialized);
2829

@@ -50,16 +51,14 @@ class UserDataSyncContribution extends Disposable implements IWorkbenchContribut
5051
) {
5152
super();
5253
this.loopSync();
53-
this._register(this.configurationService.onDidChangeConfiguration(e => {
54-
if (e.affectsConfiguration('userConfiguration.enableSync') && this.configurationService.getValue<boolean>('userConfiguration.enableSync')) {
55-
this.sync();
56-
}
57-
}));
54+
this._register(Event.filter(this.configurationService.onDidChangeConfiguration,
55+
e => e.affectsConfiguration('userConfiguration.enableSync') && this.configurationService.getValue<boolean>('userConfiguration.enableSync'))
56+
(() => this.sync()));
5857
}
5958

6059
private loopSync(): void {
6160
this.sync()
62-
.then(() => timeout(1000 * 60 * 5)) // every five minutes
61+
.then(() => timeout(500))
6362
.then(() => this.loopSync());
6463
}
6564

0 commit comments

Comments
 (0)