nutrun / lentil

golang beanstalkd client library and command line client

Home Page:http://nutrun.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graceful TCP auto-reconnect

plutov opened this issue · comments

I am using lentil in production. Sometimes I have EOF error, or connection can be lost for 1 second. After that I should manually reconnect using lentil.Dial and call again Use/Watch. It will be awesome to have it on client side, some kind of re-connection. Btw, I tried to reconnect TCP in lentil, but we still need to call Use/Watch after that, so need a more complex solution.

I will try to provide a PR to fix this issue, also please share your vision on this issue.

Hi Aliaksandr,

Is something like this what you had in mind? https://github.com/nutrun/lentil/compare/reconnecting

Run https://gist.github.com/nutrun/b51ff332c64821eff9125c6544353ddb and start/stop beanstalkd to see it reconnect after a dropped connection.

This is a rough example only and hasn't been tested at all. We'd have to implement Reconnecting* versions of all the lentil public functions.

Thanks, it should work!