在RedisTypedClient上使用BlockingDequeue时,出现了超时异常。

调用代码看起来像

 using (var client = ClientPool.GetClient())
    return client.As<TMessage>().Lists[_channel].BlockingDequeue(timeout);

超时设置为0,并且ClientPool是PooledRedisClientManager。

堆栈跟踪看起来像
ServiceStack.Redis.RedisResponseException: No more data, sPort: 51100, LastCommand:
   at ServiceStack.Redis.RedisNativeClient.CreateResponseError(String error)
   at ServiceStack.Redis.RedisNativeClient.ReadMultiData()
   at ServiceStack.Redis.RedisNativeClient.SendExpectMultiData(Byte[][] cmdWithBinaryArgs)
   at ServiceStack.Redis.RedisNativeClient.BRPop(String listId, Int32 timeOutSecs)
   at ServiceStack.Redis.Generic.RedisTypedClient`1.BlockingDequeueItemFromList(IRedisList`1 fromList, Nullable`1 timeOut)
   at ServiceStack.Redis.Generic.RedisClientList`1.BlockingDequeue(Nullable`1 timeOut)

据我所知,这是客户端保持开放连接的问题。我以为应该使用PooledRedisClientManager来解决此问题,但似乎仍然会发生。这个问题很容易重现。只需调用BlockingDequeue方法并等待大约2-3分钟,就会引发异常。

最佳答案

我曾经在Windows Azure和Redis上有过一次,我做了config set timeout 30和ServiceStack.Redis我做了

            var redisFactory = new PooledRedisClientManager(redisConn);
            redisFactory.ConnectTimeout = 5;
            redisFactory.IdleTimeOutSecs = 30;

现在由于某种原因它起作用了

关于c# - 来自BlockingDequeue的RedisResponseException,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17453594/

10-10 19:25