fix too much logs when nacos is not avaiable (#2469)

This commit is contained in:
Xin Luo
2025-06-20 14:36:01 +08:00
committed by GitHub
parent dad6278a6d
commit db66df39c4
2 changed files with 8 additions and 3 deletions

View File

@@ -50,6 +50,8 @@ const (
DefaultNacosCacheDir = "/var/log/nacos/log/mcp/cache"
DefaultNacosNotLoadCache = true
DefaultNacosLogMaxAge = 3
DefaultNacosLogMaxSize = 64
DefaultNacosLogMaxBackups = 3
DefaultRefreshInterval = time.Second * 30
DefaultRefreshIntervalLimit = time.Second * 10
)
@@ -128,6 +130,8 @@ func NewWatcher(cache memory.Cache, opts ...WatcherOption) (provider.Watcher, er
constant.WithNotLoadCacheAtStart(DefaultNacosNotLoadCache),
constant.WithLogRollingConfig(&constant.ClientLogRollingConfig{
MaxAge: DefaultNacosLogMaxAge,
MaxSize: DefaultNacosLogMaxSize,
MaxBackups: DefaultNacosLogMaxBackups,
}),
constant.WithUpdateCacheWhenEmpty(w.updateCacheWhenEmpty),
constant.WithNamespaceId(w.NacosNamespaceId),