From 1555ae9f3d33859eca23758149f4fb6020254d48 Mon Sep 17 00:00:00 2001 From: max Date: Sun, 19 Oct 2025 23:32:05 +0200 Subject: [PATCH] [CHANGE] No need to reload client from db if already loaded && can be loaded without checking library service --- Manager.App/Services/System/ClientService.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Manager.App/Services/System/ClientService.cs b/Manager.App/Services/System/ClientService.cs index 461632d..4b3525d 100644 --- a/Manager.App/Services/System/ClientService.cs +++ b/Manager.App/Services/System/ClientService.cs @@ -58,17 +58,17 @@ public class ClientService(IServiceScopeFactory scopeFactory, ILogger(comparedClients, accountsResult.Total); } - public async Task> LoadClientByIdAsync(string id, bool forceLoad = false, CancellationToken cancellationToken = default) + public async Task> LoadClientByIdAsync(string id, CancellationToken cancellationToken = default) { + if (_loadedClients.TryGetValue(id, out var client)) + { + return client; + } + if (_libraryService == null) { return ResultError.Fail("Library service is not initialized!."); } - - if (!forceLoad && _loadedClients.TryGetValue(id, out var client)) - { - return client; - } var clientResult = await _libraryService.GetChannelByIdAsync(id, cancellationToken); if (!clientResult.IsSuccess)