php-resque
php-resque copied to clipboard
worker never reconnect to redis server
I run php-rescue's workers and shutting down redis server. Then start redis again server.
workers are not down their process, but they aren't reconnect to redis server again. If workers stop when redis is down, it can recovery again by some deamonizer tools, but now, I have nothing to do with this problem.
Is there any solution to reconnect php-resque worker to recovered redis server?
That's odd. Credis's PHP implementation should try to reconnect automatically any time the worker interval passes, at least. Or crash; Credis has a bad habit of doing that when things go wrong. If the php-redis extension is installed, it should automatically reconnect at the interval without any help from Credis at all. So the fact this doesn't seem to be happening either way is... Well, as I said, that's odd.
Since we expect the Redis library (Credis or php-redis) to handle reconnection as needed, we don't have any checks to ensure the connection is still established, nor to reestablish that connection ourselves. If the library is failing to handle reconnect properly on its own, as in your case, we will need to implement such checks and reconnects to address that. I will attempt to recreate the issue on my system and check back in with more info when I have.
I have the same problem. It's quite simple to reproduce.
start a worker - generate a job - job is done restart redis (ensure that it really was down) generate a job - working is doing nothing but it teels in the logfile that it checks for jobs
I'd suggest using the redis()->ping() method and try to trigger a reconnect if possible
btw - even a dead worker would be better that something that looks like it is alive (for moniting checks / daemontools)
I have the same problem. I think we should create a process to inspect the connection.
PRs are always welcome.