mloughran / em-hiredis

Eventmachine redis client
MIT License
221 stars 63 forks source link

Handle connection timeouts / refusals #7

Closed bpo closed 11 years ago

bpo commented 12 years ago

The client retries connections forever in case of failure, and there's no way for the client's client to detect that. Need a callback that can indicate that the redis client is in an error state - perhaps a callback that gets invoked in the else condition of the on(:closed) block in client.rb[1] - it could provide a count of the number of sequential failed connections so far.

I'll tackle this if no one else is already on it / sees an easy way. Just checked out the code and the spec suite hung for a very long time after four tests, so it'll need to wait until I have a bit more time to devote to debugging.

[1] https://github.com/mloughran/em-hiredis/blob/master/lib/em-hiredis/client.rb#L35

guiocavalcanti commented 12 years ago

@bpo How are you going with that? I also need to be able to create my own reconnection strategy. Did you have any success rolling out your solution?

bpo commented 12 years ago

got swept up in other things and haven't revisited it yet. so it's nowhere right now - still on my list, but further down at the moment...

mloughran commented 12 years ago

If you take a look in the experimental branch you'll find support for this. I added it for my own use some time ago, but had completely forgotten that it was a requested feature, hence the lack of communication, sorry.

dbenamy commented 11 years ago

Thanks for your awesome work on em-hiredis!

I'm seeing em-hiredis hang when an HA floating ip is failed over from one redis server to another. I wonder if it's the same problem as this issue.

If so, how much work is involved in getting the fix from the experimental branch to master?

mloughran commented 11 years ago

Hard to know exactly what issue you're having but I definitely recommend using the experimental branch at this state - I've been using it in production for months without any issues. You'll also be able to bind to connection events and should be able to work out what's going on in your case.

dbenamy commented 11 years ago

Thanks for the suggestion.

If it's production ready, how do you feel about cutting a new release?

mloughran commented 11 years ago

I think it's long overdue :) Will try to tie up some loose ends like documentation and get it out there.