Skip to content

Commit

Permalink
Relaxed duplicate event detection criteria
Browse files Browse the repository at this point in the history
I.e., disabled duplicate detection for events other than `Changed`.
  • Loading branch information
Kir-Antipov committed Apr 16, 2024
1 parent b36ec66 commit 9b26cad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/HotAvalonia/IO/FileWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,16 @@ private bool IsWatchingFile(string fileName)
/// <returns><c>true</c> if the event is a duplicate; otherwise, <c>false</c>.</returns>
private bool IsDuplicateEvent(FileSystemEventArgs args)
{
// Currently, we only care about filtering duplicate change events:
// - They trigger most of the unnecessary work.
// - They are the most straightforward ones to detect.
//
// Since duplicates of other events don't cause as much harm,
// let's just skip them for now and return to this matter later,
// if it becomes a problem.
if (args.ChangeType is not WatcherChangeTypes.Changed)
return false;

WatcherChangeTypes type = args.ChangeType;
string path = Path.GetFullPath(args.FullPath);
StringComparer fileNameComparer = FileHelper.FileNameComparer;
Expand Down

0 comments on commit 9b26cad

Please sign in to comment.