add command to shut down a worker
[phinde.git] / bin / phinde-worker.php
index 1e94535b1d5dc86f208a7113a5f6cbbe9c1a1cb6..9f8c35aa9ff95f9e3cca309150f33349c4e3317b 100755 (executable)
@@ -23,6 +23,15 @@ $gmworker->addFunction(
     }
 );
 
+$gmworker->addFunction(
+    $GLOBALS['phinde']['queuePrefix'] . 'phinde_quit',
+    function(\GearmanJob $job) {
+        echo "Got exit job\n";
+        $job->sendComplete('');
+        exit(0);
+    }
+);
+
 while ($gmworker->work()) {
     if ($gmworker->returnCode() != GEARMAN_SUCCESS) {
         echo 'Error running job: ' . $gmworker->returnCode() . "\n";