3

Very frequently php-Resque workers will be stuck on a job for days, and eventually all the workers gets stuck and the site stops working.The php-resque library was installed using Composer.

Question: I want to do the pruning manually. How do I access this function pruneDeadWorkers()? And if dead workers are found, how do I restart them?

View Source

enter image description here

thaJeztah
  • 27,738
  • 9
  • 73
  • 92
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830

2 Answers2

6

To prune the workers manually, include the vendor/chrisboulton/php-resque/lib/Resque/Worker.php file, instantiate a Worker, then call pruneDeadWorkers();

<?php 
include 'vendor/chrisboulton/php-resque/lib/Resque/Worker.php'; // If you're not already using composer autoloader

$worker = new Worker('default'); // the argument doesn't matter
$worker->pruneDeadWorkers();

php-resque is not shipped with a function to restart workers, take a look at fresque for that.

To avoid having dead workers, compile your php with pcntl_fork, to execute your jobs in a fork, and isolating them from the workers.

Wa0x6e
  • 1,611
  • 17
  • 13
0

first find worker list : Resque_Worker::all(); this contain workers id according to php-resque doc type in command line

`kill workers id`
saeedeh
  • 343
  • 2
  • 7