Explorar el Código

OptionsSetting获取nacos实时数据调整,心跳时间延长

lichunlei hace 2 días
padre
commit
1a608f85a8
Se han modificado 2 ficheros con 6 adiciones y 2 borrados
  1. 1 1
      App/App.cs
  2. 5 1
      appsettings.Development.json

+ 1 - 1
App/App.cs

@@ -9,7 +9,7 @@ namespace Infrastructure
         /// <summary>
         /// 全局配置文件
         /// </summary>
-        public static OptionsSetting OptionsSetting => CatchOrDefault(() => ServiceProvider?.GetService<IOptions<OptionsSetting>>()?.Value);
+        public static OptionsSetting OptionsSetting => CatchOrDefault(() => ServiceProvider?.GetService<IOptionsMonitor<OptionsSetting>>()?.CurrentValue);
 
         /// <summary>
         /// 服务提供器

+ 5 - 1
appsettings.Development.json

@@ -26,6 +26,10 @@
     "ConfigUseRpc": false,
     "NamingUseRpc": false,
     "RegisterEnabled": true,
-    "InstanceEnabled": true
+    "InstanceEnabled": true,
+    "Metadata": {
+      "preserved.heart.beat.interval": "30000",
+      "preserved.heart.beat.timeout": "60000"
+    }
   }
 }