Progress
This commit is contained in:
parent
bfe790cf35
commit
39d1084a3f
22 changed files with 1158 additions and 1 deletions
23
tests/gearman_worker.php
Normal file
23
tests/gearman_worker.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
require 'ncc';
|
||||
use Tamer\Objects\Task;
|
||||
|
||||
import('net.nosial.tamerlib', 'latest');
|
||||
$worker = new \Tamer\Protocols\GearmanWorker();
|
||||
$worker->addServer();
|
||||
|
||||
$worker->addFunction('sleep', function($task) {
|
||||
var_dump(get_class($task));
|
||||
echo "Task {$task->getId()} started with data: {$task->getData()} \n";
|
||||
sleep($task->getData());
|
||||
echo "Task {$task->getId()} completed with data: {$task->getData()} \n";
|
||||
});
|
||||
|
||||
|
||||
|
||||
while(true)
|
||||
{
|
||||
echo "Waiting for job... \n";
|
||||
$worker->work();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue