Skip to content

Commit 834d72d

Browse files
author
Benjamin Pasero
committed
files2 - try to fix tests
1 parent cd7a106 commit 834d72d

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/vs/base/node/watcher.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export function watchFolder(path: string, onChange: (type: 'added' | 'changed' |
1818
return doWatchNonRecursive({ path, isDirectory: true }, onChange, onError);
1919
}
2020

21+
export const CHANGE_BUFFER_DELAY = 100;
22+
2123
function doWatchNonRecursive(file: { path: string, isDirectory: boolean }, onChange: (type: 'added' | 'changed' | 'deleted', path: string) => void, onError: (error: string) => void): IDisposable {
2224
const mapPathToStatDisposable = new Map<string, IDisposable>();
2325

@@ -101,7 +103,7 @@ function doWatchNonRecursive(file: { path: string, isDirectory: boolean }, onCha
101103
else {
102104
onChange('deleted', changedFilePath);
103105
}
104-
}, 300);
106+
}, CHANGE_BUFFER_DELAY);
105107

106108
// Very important to dispose the watcher which now points to a stale inode
107109
// and wire in a new disposable that tracks our timeout that is installed
@@ -151,7 +153,7 @@ function doWatchNonRecursive(file: { path: string, isDirectory: boolean }, onCha
151153
}
152154

153155
onChange(type, changedFilePath);
154-
}, 100);
156+
}, CHANGE_BUFFER_DELAY);
155157

156158
mapPathToStatDisposable.set(changedFilePath, toDisposable(() => clearTimeout(timeoutHandle)));
157159
}

src/vs/workbench/services/files2/node/watcher/nodejs/watcherService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
import { IDiskFileChange, normalizeFileChanges } from 'vs/workbench/services/files2/node/watcher/normalizer';
77
import { Disposable } from 'vs/base/common/lifecycle';
88
import { statLink, readlink } from 'vs/base/node/pfs';
9-
import { watchFolder, watchFile } from 'vs/base/node/watcher';
9+
import { watchFolder, watchFile, CHANGE_BUFFER_DELAY } from 'vs/base/node/watcher';
1010
import { FileChangeType } from 'vs/platform/files/common/files';
1111
import { ThrottledDelayer } from 'vs/base/common/async';
1212
import { join, basename } from 'vs/base/common/path';
1313

1414
export class FileWatcher extends Disposable {
1515
private isDisposed: boolean;
1616

17-
private fileChangesDelayer: ThrottledDelayer<void> = this._register(new ThrottledDelayer<void>(50));
17+
private fileChangesDelayer: ThrottledDelayer<void> = this._register(new ThrottledDelayer<void>(CHANGE_BUFFER_DELAY * 2 /* sync on delay from underlying library */));
1818
private fileChangesBuffer: IDiskFileChange[] = [];
1919

2020
constructor(

0 commit comments

Comments
 (0)