note 116032 added to gearmanclient.addtask
| From: | stanislav dot reshetnev at gmail dot com | Date: | Fri, 31 Oct 2014 16:17:11 +0000 |
| Subject: | note 116032 added to gearmanclient.addtask | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200760@lists.php.net to get a copy of this message | ||
Note that param $unique must be different for multiple tasks if You want to run they all separately.
If param $unique is equal for multiple tasks You will get the same task:
<?php
$unique=1;
$gclient = GearmanClient();
$gclient->addServer('srv');
$this->setCreatedCallback(function(GearmanTask $task) {
print $task->jobHandle() . "\n";
});
$gclient->addTask('function_name', 'workload', null, $unique);
$gclient->addTask('function_name', 'workload', null, $unique);
$gclient->addTask('function_name', 'workload', null, $unique);
$gclient->runTasks();
sleep(5);
?>
This sript will print only one handler:
H:srv:377382343
H:srv:377382343
H:srv:377382343
----
Server IP: 72.52.91.14
Probable Submitter: 80.251.133.198
----
Manual Page -- http://php.net/manual/en/gearmanclient.addtask.php
Edit -- https://master.php.net/note/edit/116032
Del: integrated -- https://master.php.net/note/delete/116032/integrated
Del: useless -- https://master.php.net/note/delete/116032/useless
Del: bad code -- https://master.php.net/note/delete/116032/bad+code
Del: spam -- https://master.php.net/note/delete/116032/spam
Del: non-english -- https://master.php.net/note/delete/116032/non-english
Del: in docs -- https://master.php.net/note/delete/116032/in+docs
Del: other reasons-- https://master.php.net/note/delete/116032
Reject -- https://master.php.net/note/reject/116032
Search -- https://master.php.net/manage/user-notes.php