If there is a way to throw an exception when connect is broken #305

Open
cdnewbee opened this Issue Feb 25, 2013 · 3 comments

2 participants

@cdnewbee

I would be happy if my phpredis can work like this:
1. connect (maybe remotely) to redis server with timeout = 0 (no timeout occurs)
2. subscribe to a redis channel
3. When connect is broken, throw an exception
4. Get the exception, make some logs, notifications and may re-connect.

This is likely one of the way that I can use the redis as a message queue with this feature, and I am wondering is there any way the phppredis can work like this?

@michael-grunder
phpredis member

Interesting. Is the problem now that if the connection is broken you don't get any messages? I will have to test that sort of process to see what I can come up with.

@cdnewbee

In my limited test, it is. When I break the connection manually, there is no exception, no any error message. It is even the worse that in my test I totally lose the control of the original processes. They just become isolated and I have to kill them by process id.

@cdnewbee

The code for connection:
protected static $_default_config = array(
'host' => '192.168.1.80',
'password' => NULL,
'port' => 6379,
'timeout' => 0
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment