File tree Expand file tree Collapse file tree
extensions/ql-vscode/src/databases/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,9 +166,20 @@ export class DbConfigStore extends DisposableObject {
166166 }
167167
168168 private watchConfig ( ) : void {
169- this . configWatcher = chokidar . watch ( this . configPath ) . on ( "change" , ( ) => {
170- this . readConfigSync ( ) ;
171- } ) ;
169+ this . configWatcher = chokidar
170+ . watch ( this . configPath , {
171+ // In some cases, change events are emitted while the file is still
172+ // being written. The awaitWriteFinish option tells the watcher to
173+ // poll the file size, holding its add and change events until the size
174+ // does not change for a configurable amount of time. We set that time
175+ // to 1 second, but it may need to be adjusted if there are issues.
176+ awaitWriteFinish : {
177+ stabilityThreshold : 1000 ,
178+ } ,
179+ } )
180+ . on ( "change" , ( ) => {
181+ this . readConfigSync ( ) ;
182+ } ) ;
172183 }
173184
174185 private createEmptyConfig ( ) : DbConfig {
You can’t perform that action at this time.
0 commit comments