Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Service Stack Redis reconnect after Redis server reboot

We are using Service Stack's RedisClient's BlockingDequeue to persist some data until it can be processed. The calling code looks like

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

If the server hosting Redis is restarted, the connections for the BlockingDequeue go zombie and never return until the client application is restarted.

We have tried setting the timeout on the BlockingDequeue as well as the PooledConnectionManager but neither helped, I am guessing because the timeout is enforced on the server side.

Is this type of fault tolerance built into service stack and we are missing it?

Or is it something that our implementation should handle? If so are there any recommended approaches?

like image 410
swestner Avatar asked Dec 13 '13 16:12

swestner


1 Answers

We encountered the same issue in our ServiceStack.Redis subscription code, we tried a few settings, such as retrycount, retrytimeout, etc, none of them works, later our workaround is to catch the RedisException and do the subscribe again.

like image 121
Bruce Liu Avatar answered Nov 15 '22 10:11

Bruce Liu