Skip to content

Commit 2ff1002

Browse files
committed
add mapping for InstanceKey to EventHandler for InitialSyncHandlers
1 parent ed1d83b commit 2ff1002

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

CSync/Lib/ConfigManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace CSync.Lib;
2121
public class ConfigManager {
2222
internal static readonly Dictionary<string, ConfigFile> FileCache = [];
2323
internal static readonly Dictionary<InstanceKey, ISyncedConfig> Instances = [];
24+
internal static readonly Dictionary<InstanceKey, EventHandler> InitialSyncHandlers = [];
2425

2526
private static event Action? OnPopulateEntriesRequested;
2627
internal static void PopulateEntries() => OnPopulateEntriesRequested?.Invoke();
@@ -80,6 +81,7 @@ public static void Register<T>(T config) where T : SyncedConfig<T> {
8081

8182
try {
8283
Instances.Add(key, config);
84+
InitialSyncHandlers.Add(key, config.OnInitialSyncCompleted);
8385
}
8486
catch (ArgumentException exc) {
8587
throw new InvalidOperationException($"Attempted to register config instance of type `{typeof(T)}`, but an instance has already been registered.", exc);

0 commit comments

Comments
 (0)