php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59533 GearmanJob::unique() returns empty string
Submitted: 2010-12-08 03:49 UTC Modified: 2011-01-27 18:11 UTC
From: nvpetlin at gmail dot com Assigned:
Status: Closed Package: gearman (PECL)
PHP Version: 5.2.11 OS: RHEL 5.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nvpetlin at gmail dot com
New email:
PHP Version: OS:

 

 [2010-12-08 03:49 UTC] nvpetlin at gmail dot com
Description:
------------
When assigning a unique identifier by running 
doBackground(name,data,id) it cannot be retrieved at the other 
end in the worker function.





Reproduce code:
---------------
--- worker.php
<?php
  $worker= new GearmanWorker();
  $worker->addServer();
  $worker->addFunction("title", "title_function");
  while ($worker->work());

  function title_function($job)
  {
        var_dump($job->unique());
        return ucwords(strtolower($job->workload()));
  }
--- client.php
<?php
$client = new GearmanClient();
$client->addServers('uslx1');
print $client->doBackground('title', "AlL THE World's a sTagE",'unique');
print "\n";


Expected result:
----------------
string "unique"
job handle

Actual result:
--------------
string(0) ""
job handle

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-27 17:05 UTC] james dot butler at edigitalresearch dot com
This is not a bug.
You need add the option GEARMAN_WORKER_GRAB_UNIQ to you 
worker options.

<?php
  $worker= new GearmanWorker();
  $worker->addServer();
  $worker->addOptions(GEARMAN_WORKER_GRAB_UNIQ);
  ....
?>

GearmanJob::unique will nor return the unique value the 
client assigns it
 [2011-01-27 18:06 UTC] nvpetlin at gmail dot com
Then there is something wrong with the documentation 
(http://www.php.net/manual/en/gearmanjob.unique.php)

"Returns the unique identifiter for this job. The identifier 
is assigned by the client."

Quite the opposite to 
"GearmanJob::unique will nor return the unique value the 
client assigns it"
 [2011-01-27 18:11 UTC] nvpetlin at gmail dot com
I just realized that you meant now instead of not. I 
apologize for my hasty conclusion. The option should perhaps 
be mentioned in the documentation then. As the function seems 
not to be working without it. Well then i rest my case, thank 
you for responding.
 [2011-01-28 12:21 UTC] james dot butler at edigitalresearch dot com
sorry for the mispelling/grammar, was having a fat fingers 
day. Yes this does need fixing in the documentation. I'll 
raise a bug for it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC