You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+1 I have rolled this by hand, and it makes the code a lot more confusing.
@ceejbot Do you have plans to add this to fivebeans, or is this something you'd prefer to see implimented in a wrapper library? If it's the later, I can throw something together no problem.
This thing has automatic reconnects and automatically re-uses / re-watches tubes on reconnect. It doesn't have anything advanced like an exponential backoff etc., but seems to work. Would be nice to get more mileage on it
Having reconnect functionality after the beanstalkd server is gone away was also crucial for our infrastructure.
As we tried to implement a reconnect logic around fivebeans, we ran into multiple issues. One of them was that if we call worker.watch() inside our worker.on('close') callback function, fivebeans would also add the client listeners (on('connect'), on('error'), etc.) again, which of course would lead to an event emitter memory leak during the reconnection attempts.
Just calling worker.client.connect() during the reconnection attempts fixed the listener issue. However after the beanstalkd server was up again, all new jobs added to the queue had a mysterious hang followed by a DEADLINE_SOON after they were processed. At this point, the handler was already done, but it took a couple of seconds until the job was properly deleted.
So not sure if a reconnection behavior should be part of fivebeans, but one possible solution could be to write a simple wrapper which uses a separate connection to just check the availability of the beanstalkd server and reinitializes the worker if it was able to reconnect.
Okay, this is pretty clearly something the module needs to do. Give me a little bit to reacquaint myself with what the heck I was thinking when I wrote it (my first node module ever, if you want to be scared) and make it reconnect. I like the server approach above.
Activity
ceejbot commentedon Jul 2, 2014
Or this is straightforward to roll by hand if necessary. Good bug.
rjrodger commentedon Jul 2, 2014
I tried rolling it by hand, but I couldn’t get it working and then my brain hurt :)
Any pointers on how to approach this?
On 2 Jul 2014, at 18:18, C J Silverio notifications@github.com wrote:
JoshWillik commentedon Sep 24, 2015
+1 I have rolled this by hand, and it makes the code a lot more confusing.
@ceejbot Do you have plans to add this to fivebeans, or is this something you'd prefer to see implimented in a wrapper library? If it's the later, I can throw something together no problem.
siddo420 commentedon Sep 30, 2015
+1
need this behaviour as part of the library itself including reconnect and retry strategies
gtamas commentedon Nov 19, 2015
+1 I need this too
wltsmrz commentedon Feb 19, 2016
This thing has automatic reconnects and automatically re-uses / re-watches tubes on reconnect. It doesn't have anything advanced like an exponential backoff etc., but seems to work. Would be nice to get more mileage on it
michaelfreund commentedon Jun 7, 2016
Having reconnect functionality after the beanstalkd server is gone away was also crucial for our infrastructure.
As we tried to implement a reconnect logic around fivebeans, we ran into multiple issues. One of them was that if we call
worker.watch()inside ourworker.on('close')callback function, fivebeans would also add the client listeners (on('connect'),on('error'), etc.) again, which of course would lead to an event emitter memory leak during the reconnection attempts.Just calling
worker.client.connect()during the reconnection attempts fixed the listener issue. However after the beanstalkd server was up again, all new jobs added to the queue had a mysterious hang followed by aDEADLINE_SOONafter they were processed. At this point, the handler was already done, but it took a couple of seconds until the job was properly deleted.So not sure if a reconnection behavior should be part of fivebeans, but one possible solution could be to write a simple wrapper which uses a separate connection to just check the availability of the beanstalkd server and reinitializes the worker if it was able to reconnect.
The following seems to work
What do you think?
ceejbot commentedon Jun 7, 2016
Okay, this is pretty clearly something the module needs to do. Give me a little bit to reacquaint myself with what the heck I was thinking when I wrote it (my first node module ever, if you want to be scared) and make it reconnect. I like the server approach above.
michaelfreund commentedon Oct 31, 2016
@ceejbot did you reacquaint with your first baby? 😁 meanwhile our solution runs in production without any problems.