This commit is contained in:
Netkas 2023-02-01 19:22:26 -05:00
parent bfe790cf35
commit 39d1084a3f
22 changed files with 1158 additions and 1 deletions

23
tests/gearman_worker.php Normal file
View 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();
}