Pārlūkot izejas kodu

update Admin.NET/Admin.NET.Core/Service/Config/SysConfigService.cs.
fix: 业务应用场景中,后台服务读取缓存因没有缓存,及db未完全导致的偶发性错误

Signed-off-by: xin12023 <chenxin2024@gmail.com>

xin12023 1 gadu atpakaļ
vecāks
revīzija
eefd14efea

+ 1 - 1
Admin.NET/Admin.NET.Core/Service/Config/SysConfigService.cs

@@ -147,7 +147,7 @@ public class SysConfigService : IDynamicApiController, ITransient
         var value = _sysCacheService.Get<string>($"{CacheConst.KeyConfig}{code}");
         if (string.IsNullOrEmpty(value))
         {
-            var config = await _sysConfigRep.GetFirstAsync(u => u.Code == code);
+            var config = await _sysConfigRep.CopyNew().GetFirstAsync(u => u.Code == code);
             value = config != null ? config.Value : default;
             _sysCacheService.Set($"{CacheConst.KeyConfig}{code}", value);
         }