Skip to content

Commit

Permalink
chore(aft): Fewer file watchers
Browse files Browse the repository at this point in the history
Instead of creating a file watcher for each file, use the `recursive` option to create watchers for the directory instead which is more performant.
  • Loading branch information
Dillon Nys authored and dnys1 committed Jul 14, 2023
1 parent 6dff722 commit 832ad60
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/aft/lib/src/commands/docs_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,16 @@ class _PackageWatcher implements Closeable {
void _listenForEvents() {
final entitiesToWatch = const [
'doc/*.yaml',
'doc/lib/**',
'doc/static/**',
'lib/**',
'doc/lib/',
'doc/static/',
'lib/',
'*.yaml',
]
.map((path) => p.join(package.path, path))
.expand((subpath) => Glob(subpath).listSync());
final eventStream = StreamGroup.merge([
for (final entity in entitiesToWatch)
entity.watch(events: FileSystemEvent.all),
entity.watch(events: FileSystemEvent.all, recursive: true),
]);

Future<void>? currentOperation;
Expand Down

0 comments on commit 832ad60

Please sign in to comment.