FreeRedis icon indicating copy to clipboard operation
FreeRedis copied to clipboard

最近总出现System.TimeoutException: [r-bp1xxxxxxxxxx.redis.rds.aliyuncs.com:6379/0] ObjectPool.Get() timeout 10 seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081

Open icejd opened this issue 2 months ago • 1 comments

单例模式 static Lazy<RedisClient> _cliLazy = new Lazy<RedisClient>(() => { RedisClient _database;= new RedisClient($"{masterhost},password={password}"); _database.Serialize = obj => JsonConvert.SerializeObject(obj); _database.Deserialize = (json, type) => JsonConvert.DeserializeObject(json, type); //_database.Notice += _database_Notice; return _database; }); static RedisClient Instance => _cliLazy.Value; 访问量似乎也没有那么大,没啥特殊的用处,也就是缓存,感觉不至于挂掉 .net 4.8 1.5.3.0 基本是卡死在这里 public static TB_S_SysConfigModel GetBaseModel(int sysid = 1) { TB_S_SysConfigModel configModel = CacheHelper.Get<TB_S_SysConfigModel>(cacheKey); if (configModel == null) { configModel = TB_S_SysConfigDAL.GetBaseModel(sysid); CacheHelper.Set(cacheKey, configModel); } return configModel; }

icejd avatar Dec 07 '25 14:12 icejd

这个错误大概率是用错了,单例+max pool size 不要用 GetDatabase

2881099 avatar Dec 09 '25 16:12 2881099