note 117913 added to gearmanclient.addtaskbackground
| From: | Anonymous | Date: | Mon, 31 Aug 2015 20:02:11 +0000 |
| Subject: | note 117913 added to gearmanclient.addtaskbackground | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203537@lists.php.net to get a copy of this message | ||
It is unlikely this example works quite as advertised.
The foreground job will block, however the background job should not.. (and if it does that's
not documented Gearman behaviour far as I know and would not make sense for a Background job).
So, if the foreground job completes, then we would expect runTasks() to return at that moment,
regardless of the status of the background job(s). With nothing else to do, the php script (the
client) in this example would exit at that point.
To fully-utilize background jobs, it's reasonable to assume that we still wish to know their
status. To do that, you need a polling loop that "checks up on them" and waits until their
completion.
That eliminates the point of background jobs of course - because the client would still be Blocking
(in a polling loop) more or less occupied, and unable to exit/finish.
So, in practice, background jobs mean you are decoupled from the client upon execution (because the
main point is to free up the client, otherwise just use foreground execution), which means the
client is likely going to exit, meaning the jobs themselves should be reporting their status and
final result independently, not leaving it up to the client.
It's a significantly different setup compared to foreground jobs. In fact this example is kind
of silly to even mix the two.
Nobody will ever see this post, because apparently nobody in the world has ever commented on the php
gearman client, but it's a good post never the less.
----
Server IP: 72.52.91.14
Probable Submitter: 206.47.249.247
----
Manual Page -- http://php.net/manual/en/gearmanclient.addtaskbackground.php
Edit -- https://master.php.net/note/edit/117913
Del: integrated -- https://master.php.net/note/delete/117913/integrated
Del: useless -- https://master.php.net/note/delete/117913/useless
Del: bad code -- https://master.php.net/note/delete/117913/bad+code
Del: spam -- https://master.php.net/note/delete/117913/spam
Del: non-english -- https://master.php.net/note/delete/117913/non-english
Del: in docs -- https://master.php.net/note/delete/117913/in+docs
Del: other reasons-- https://master.php.net/note/delete/117913
Reject -- https://master.php.net/note/reject/117913
Search -- https://master.php.net/manage/user-notes.php