-
Notifications
You must be signed in to change notification settings - Fork 35
Description
When losing a connection to the Gearman server currently GearmaNode does not have an option to reestablish the connection.
I thought of implementing such a solution outside of GearmanNode (for a worker), but that would be difficult when load balancing between multiple servers. The only straightforward option would be to discard the Worker instance and create a new one, but in doing so either the old worker would remain connected to the other server(s) which remained up, or the old Worker could be closed in which case there would be a time without a Worker connection to any server.
So would you be open to including an optional connection retry mechanism inside of GearmaNode? I haven't thought much about the client connections, but for the worker connections I think all that would be needed is to
- listen to 'socketDisconnect'
- retry connecting with options for interval and retryCount
- once connected add the server back into the JobManager jobServer list
- re-register all known worker functions in Worker.functions
I could give it a shot, but does such a plan make sense or is anyone aware of a work around or pitfalls to consider first?