Skip to content

Commit 42ffec4

Browse files
alan-agius4dherges
authored andcommitted
perf: add teardown logic for watch (#980)
When the observable has complete or errored. The watch should be closed.
1 parent 5c6027b commit 42ffec4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lib/file/file-watcher.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ export function createFileWatch(
3333

3434
return Observable.create(observer => {
3535
watch.on('all', (event: FileWatchEvent, filePath: string) => handleFileChange(event, filePath, observer));
36+
return () => watch.close();
3637
});
3738
}

0 commit comments

Comments
 (0)