Note that there are some explanatory texts on larger screens.

plurals
  1. POOnly one gearman worker is getting jobs
    primarykey
    data
    text
    <p>I have a gearman worker written in PHP that echoes something and sleeps a few seconds. I started two instances of this worker and when a I now run gearman a couple of times to do that job only one of the workers (the last one that I started) is executed--never the other one although the client has to wait until this worker has finished his job. Am I doing something wrong here or is that the idea of how gearman should word?</p> <pre><code># cat ./testworker.php &lt;?php $Worker = new \GearmanWorker; $Worker-&gt;addServers('127.0.0.1:4730'); $Worker-&gt;addFunction('test', 'work'); while ($Worker-&gt;work() || $Worker-&gt;returnCode() == GEARMAN_TIMEOUT) { if ($Worker-&gt;returnCode() != GEARMAN_SUCCESS) break; } function work() { echo getmypid(); sleep(1); } </code></pre> <p>Then I started the worker in two consoles with the command</p> <pre><code># php ./testworker.php </code></pre> <p>Then I ran gearman to jun the job a couple of times:</p> <pre><code># gearman -f test -s </code></pre> <p>Could it be that I need the -t option for the gearman daemon? I am working on OS-X.</p> <pre><code># ps ax | grep gearman 4128 ?? Ss 0:00.02 /opt/local/bin/daemondo --label=gearmand --start-cmd /opt/local/sbin/gearman 4129 ?? S 0:00.04 /opt/local/sbin/gearmand -vv --port=4730 -u root --pid-file=/opt/local/var/r 4250 p5 S+ 0:00.01 grep gearman </code></pre> <p>BTW: How can I change any options in a daemondo controlled process? I changed /opt/local/etc/LaunchDaemons/org.macports.gearmand/org.macports.gearmand.plist but I think I need to execute a commans that re-reads the list.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload