}
);
+$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";
--- /dev/null
+#!/usr/bin/env php
+<?php
+//stop a single running worker
+namespace phinde;
+require_once __DIR__ . '/../src/init.php';
+
+$gmclient = new \GearmanClient();
+$gmclient->addServer('127.0.0.1');
+$gmclient->doHigh(
+ $GLOBALS['phinde']['queuePrefix'] . 'phinde_quit', 'none'
+);
+?>