note 105391 deleted from gearmanclient.do by danbrown
| From: | danbrown@php.net | Date: | Sun, 14 Aug 2011 16:42:03 +0000 |
| Subject: | note 105391 deleted from gearmanclient.do by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182478@lists.php.net to get a copy of this message | ||
Note Submitter: orwellophile at php dot spamtrak dot org
----
@shane: It turns out that do() is in-fact blocking. Specifically, it will not return until either
the results of the job are returned from the server, or a timeout occurs.
The notable exception to this, is if a job returns status information of some sort.
<?php
self::$gmclient= new GearmanClient();
self::$gmclient->setTimeout(15000);
self::$gmclient->addServer(self::$server);
printf("%s: calling do()\n", date("H:i:s"));
$value = self::$gmclient->do($function, $args);
printf("%s: do() returned %d\n", date("H:i:s"), $value);
/* Output:
19:28:06: calling do()
Warning: GearmanClient::do(): gearman_wait:timeout reached in trunk/MyGearmanClient.php
19:28:17: do() returned 0
*/
?>
Note the ~ 15 seconds between invocation and return, as specified in setTimeout