Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #483 from memfork/fix-could-not-working-task-when-…
Browse files Browse the repository at this point in the history
…enabling-task_enable_coroutine

fix could not working onTask when enabling task_enable_coroutine on swoole_http.php
  • Loading branch information
Arkanius committed Apr 22, 2021
2 parents f94b69f + c89542d commit ebc5859
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Server/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,19 @@ protected function resetOnRequest()
*
* @param mixed $server
* @param string|\Swoole\Server\Task $taskId or $task
* @param string $srcWorkerId
* @param mixed $data
* @param string|null $srcWorkerId
* @param mixed|null $data
*/
public function onTask($server, $taskId, $srcWorkerId, $data)
public function onTask($server, $task, $srcWorkerId = null, $data = null)
{
if ($task instanceof Task) {
$data = $task->data;
$srcWorkerId = $task->worker_id;
$taskId = $task->id;
} else {
$taskId = $task;
}

$this->container->make('events')->dispatch('swoole.task', func_get_args());

try {
Expand Down

0 comments on commit ebc5859

Please sign in to comment.