Skip to content

Commit 91ef31a

Browse files
committed
Minor refactor
1 parent d273c69 commit 91ef31a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ internal class ConsoleWatch
304304
#pragma warning restore S2223
305305

306306
private static ConcurrentDictionary<string, DateTime> ConverterSavedFileDates = new ConcurrentDictionary<string, DateTime>();
307-
private static readonly AsyncLockQueueDictionary FileLocks = new AsyncLockQueueDictionary();
307+
private static readonly AsyncLockQueueDictionary FileEventLocks = new AsyncLockQueueDictionary();
308308

309309

310310
public ConsoleWatch(IWatcher3 watch)
@@ -561,8 +561,8 @@ private static async Task OnRenamedAsync(IRenamedFileSystemEvent rfse, Cancellat
561561
//NB! in order to avoid deadlocks in case of file swaps, always take the locks in deterministic order
562562
filenames.Sort(StringComparer.InvariantCultureIgnoreCase);
563563

564-
using (await FileLocks.LockAsync(filenames[0], token))
565-
using (await FileLocks.LockAsync(filenames[1], token))
564+
using (await FileEventLocks.LockAsync(filenames[0], token))
565+
using (await FileEventLocks.LockAsync(filenames[1], token))
566566
{
567567
await FileUpdated(rfse.FileSystemInfo.FullName, context);
568568
await FileDeleted(rfse.PreviousFileSystemInfo.FullName, context);
@@ -595,7 +595,7 @@ private static async Task OnRemovedAsync(IFileSystemEvent fse, CancellationToken
595595
{
596596
await AddMessage(ConsoleColor.Yellow, $"[{(fse.IsFile ? "F" : "D")}][-]:{fse.FileSystemInfo.FullName}", context);
597597

598-
using (await FileLocks.LockAsync(fse.FileSystemInfo.FullName, token))
598+
using (await FileEventLocks.LockAsync(fse.FileSystemInfo.FullName, token))
599599
{
600600
await FileDeleted(fse.FileSystemInfo.FullName, context);
601601
}
@@ -624,7 +624,7 @@ public static async Task OnAddedAsync(IFileSystemEvent fse, CancellationToken to
624624
{
625625
//await AddMessage(ConsoleColor.Green, $"[{(fse.IsFile ? "F" : "D")}][+]:{fse.FileSystemInfo.FullName}", context);
626626

627-
using (await FileLocks.LockAsync(fse.FileSystemInfo.FullName, token))
627+
using (await FileEventLocks.LockAsync(fse.FileSystemInfo.FullName, token))
628628
{
629629
await FileUpdated(fse.FileSystemInfo.FullName, context);
630630
}
@@ -656,7 +656,7 @@ private static async Task OnTouchedAsync(IFileSystemEvent fse, CancellationToken
656656
{
657657
await AddMessage(ConsoleColor.Gray, $"[{(fse.IsFile ? "F" : "D")}][T]:{fse.FileSystemInfo.FullName}", context);
658658

659-
using (await FileLocks.LockAsync(fse.FileSystemInfo.FullName, token))
659+
using (await FileEventLocks.LockAsync(fse.FileSystemInfo.FullName, token))
660660
{
661661
await FileUpdated(fse.FileSystemInfo.FullName, context);
662662
}

0 commit comments

Comments
 (0)