Skip to content

Commit 11bc7a4

Browse files
committed
Add snapshot and reconciliation after starting file system watcher to detect changes
1 parent ac6bf32 commit 11bc7a4

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/Cocoar.FileSystem/ResilientFileSystemMonitor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,11 @@ private void TryStartFileSystemWatcher()
305305
_state = MonitorState.Watching;
306306
StopPollingTimer();
307307

308+
// Take a fresh snapshot and reconcile to detect any changes that occurred
309+
// while we were in polling mode or during the transition
310+
var currentSnapshot = Snapshot(_rootPath);
311+
Reconcile(currentSnapshot);
312+
308313
EnqueueEvent(new EventEntry(EventType.ModeChanged, null!, ModeArgs: new ModeChangedEventArgs(WatcherMode.Native, "watcher started")));
309314
}
310315
catch (Exception ex)

0 commit comments

Comments
 (0)