This commit is contained in:
2021-03-01 15:54:11 +08:00
parent b859a582c7
commit b4388fd7d2
2 changed files with 23 additions and 28 deletions
+16 -14
View File
@@ -16,19 +16,21 @@ use Swoole\Server;
*/
class OnFinish extends Callback
{
/**
* @param Server $server
* @param $task_id
* @param $data
* @throws Exception
*/
public function onHandler(Server $server, $task_id, $data)
{
try {
fire(Event::TASK_FINISH, [$task_id, $data]);
} catch (\Throwable $exception) {
$this->addError($exception, 'task');
}
}
/**
* @param Server $server
* @param $task_id
* @param $data
* @throws Exception
*/
public function onHandler(Server $server, $task_id, $data)
{
try {
fire(Event::TASK_FINISH, [$task_id, $data]);
} catch (\Throwable $exception) {
$this->addError($exception, 'task');
} finally {
Snowflake::app()->decrement();
}
}
}