miyagawa / AnyEvent-Redis

Asynchronous Redis client
http://search.cpan.org/dist/AnyEvent-Redis
41 stars 16 forks source link

re-attempt commands on Broken Pipe error #20

Open leedo opened 12 years ago

leedo commented 12 years ago

This adds a reconnect option that will re-queue commands and try to reconnect when the connection breaks. Might be worth adding some timing options for increasing the time between reconnect attempts.

leedo commented 12 years ago

Does this look sane to you all? A couple things I wasn't sure about

dgl commented 12 years ago

I need to think about this some more. It looks like it should work but I don't like the string matching on Broken pipe (why only that? I'm also confused where the error comes from -- line 308 doesn't actually use $err that I can see)

leedo commented 12 years ago

The reason I limited to Broken pipe errors was because I don't think we should reconnect on protocol errors (I think those could end up there).

Re: $err, I would think croak should pass in $err instead of $res on line 308. /cc @chipdude