Closed teevil closed 5 years ago
这样写,任务无法投递 TaskManager::async( Message::class ); 这样写,任务可以投递并运行任务。 TaskManager::async( Message::class, function(){} ); Message.php `<?php namespace App\HttpController\Api\Task; use EasySwoole\EasySwoole\Swoole\Task\AbstractAsyncTask; class Message extends AbstractAsyncTask { protected function run($taskData, $taskId, $fromWorkerId, $flags = null) { echo "异步任务开始\n"; return true; }
TaskManager::async( Message::class );
TaskManager::async( Message::class, function(){} );
protected function finish($result, $task_id) { echo "异步任务结束\n"; }
}`
这是swoole底层的一个问题。请升级到4.3.0的swoole
这样写,任务无法投递
TaskManager::async( Message::class );
这样写,任务可以投递并运行任务。TaskManager::async( Message::class, function(){} );
Message.php `<?php namespace App\HttpController\Api\Task; use EasySwoole\EasySwoole\Swoole\Task\AbstractAsyncTask; class Message extends AbstractAsyncTask { protected function run($taskData, $taskId, $fromWorkerId, $flags = null) { echo "异步任务开始\n"; return true; }}`