From 76a3b624daf37cb2f4f4f8cb5e0065097c259ef8 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 10 Jan 2022 21:13:28 -0600 Subject: require restart if queues are removed --- src/slskd/Application.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 3f0490dc..63ac2cc0 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -588,7 +588,7 @@ namespace slskd var requiresRestart = HasAttribute(property); var requiresReconnect = HasAttribute(property); - Log.Debug($"{fqn} changed from '{left.ToJson() ?? ""}' to '{right.ToJson() ?? ""}'{(requiresRestart ? "; Restart required to take effect." : string.Empty)}{(requiresReconnect ? "; Reconnect required to take effect." : string.Empty)}"); + Log.Debug($"{fqn} changed from '{left.ToJson() ?? ""}' to '{right.ToJson() ?? ""}'{(requiresRestart ? ". Restart required to take effect." : string.Empty)}{(requiresReconnect ? "; Reconnect required to take effect." : string.Empty)}"); pendingRestart |= requiresRestart; pendingReconnect |= requiresReconnect; @@ -601,6 +601,13 @@ namespace slskd Log.Information("Shared directory configuration changed. Shares must be re-scanned for changes to take effect."); } + var removedQueues = PreviousOptions.Queues.Custom.Keys.Where(key => !newOptions.Queues.Custom.ContainsKey(key)); + if (removedQueues.Any()) + { + Log.Information("Custom queue(s) {Queues} removed or renamed. Restart required to take effect.", string.Join(", ", removedQueues)); + pendingRestart = true; + } + if (PreviousOptions.Filters.Share.Except(newOptions.Filters.Share).Any() || newOptions.Filters.Share.Except(PreviousOptions.Filters.Share).Any()) { @@ -615,8 +622,6 @@ namespace slskd _ = RoomService.TryJoinAsync(newOptions.Rooms); } - // todo: determine if any custom queues were deleted, and require a restart if so - // determine whether any Soulseek options changed. if so, we need to construct a patch and invoke ReconfigureOptionsAsync(). var slskDiff = PreviousOptions.Soulseek.DiffWith(newOptions.Soulseek); -- cgit v1.2.3