fix yaml hotreloading (#5907)

This commit is contained in:
slarticodefast
2025-05-04 04:33:37 +02:00
committed by GitHub
parent cfd2b03248
commit aee03f0805

View File

@@ -25,6 +25,7 @@ internal sealed class ReloadManager : IReloadManager
private readonly TimeSpan _reloadDelay = TimeSpan.FromMilliseconds(10);
private CancellationTokenSource _reloadToken = new();
private readonly HashSet<ResPath> _reloadQueue = new();
private List<FileSystemWatcher> _watchers = new(); // this list is never used but needed to prevent them from being garbage collected
public event Action<ResPath>? OnChanged;
@@ -93,6 +94,7 @@ internal sealed class ReloadManager : IReloadManager
NotifyFilter = NotifyFilters.LastWrite
};
_watchers.Add(watcher); // prevent garbage collection
watcher.Changed += OnWatch;