Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions extensions/ql-vscode/src/databases/config/db-config-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,20 @@ export class DbConfigStore extends DisposableObject {
}

private watchConfig(): void {
this.configWatcher = chokidar.watch(this.configPath).on("change", () => {
this.readConfigSync();
});
this.configWatcher = chokidar
.watch(this.configPath, {
// In some cases, change events are emitted while the file is still
// being written. The awaitWriteFinish option tells the watcher to
// poll the file size, holding its add and change events until the size
// does not change for a configurable amount of time. We set that time
// to 1 second, but it may need to be adjusted if there are issues.
awaitWriteFinish: {
stabilityThreshold: 1000,
},
})
.on("change", () => {
this.readConfigSync();
});
}

private createEmptyConfig(): DbConfig {
Expand Down