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 #229 from swooletw/master
Browse files Browse the repository at this point in the history
From master to develop
  • Loading branch information
albertcht authored Mar 3, 2019
2 parents 8fa56e6 + e0b9167 commit 9a06fd2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Server/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,19 @@ protected function resetOnRequest()
* Set onTask listener.
*
* @param mixed $server
* @param string $taskId
* @param string $srcWorkerId
* @param mixed $data
* @param string|\Swoole\Server\Task $taskIdOrTask
* @param string $srcWorkerId Optional
* @param mixed $data Optional
*/
public function onTask($server, $taskId, $srcWorkerId, $data)
public function onTask($server, ...$args)
{
$this->container->make('events')->fire('swoole.task', func_get_args());
if ($args[0] instanceof \Swoole\Server\Task && $task = array_shift($args)) {
list($taskId, $srcWorkerId, $data) = [$task->id, $task->worker_id, $task->data];
} else {
list($taskId, $srcWorkerId, $data) = $args;
}

$this->container->make('events')->fire('swoole.task', [$server, $taskId, $srcWorkerId, $data]);

try {
// push websocket message
Expand Down

0 comments on commit 9a06fd2

Please sign in to comment.