改名
This commit is contained in:
@@ -28,6 +28,8 @@ class OnFinish extends Callback
|
||||
fire(Event::TASK_FINISH, [$task_id, $data]);
|
||||
} catch (\Throwable $exception) {
|
||||
$this->addError($exception, 'task');
|
||||
} finally {
|
||||
Snowflake::app()->decrement();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,16 +48,12 @@ class OnTask extends Callback
|
||||
*/
|
||||
public function onTask(Server $server, int $task_id, int $from_id, string $data): mixed
|
||||
{
|
||||
$app = Snowflake::app()->increment();
|
||||
Coroutine\defer(function () use ($app) {
|
||||
$app->decrement();
|
||||
});
|
||||
|
||||
$time = microtime(TRUE);
|
||||
Snowflake::app()->increment();
|
||||
if (empty($data)) {
|
||||
return $server->finish('null data');
|
||||
}
|
||||
|
||||
$time = microtime(TRUE);
|
||||
$finish = $this->runTaskHandler($data);
|
||||
if (!$finish) {
|
||||
$finish = [];
|
||||
@@ -78,15 +74,12 @@ class OnTask extends Callback
|
||||
*/
|
||||
public function onContinueTask(Server $server, Server\Task $task): mixed
|
||||
{
|
||||
$app = Snowflake::app()->increment();
|
||||
Coroutine\defer(function () use ($app) {
|
||||
$app->decrement();
|
||||
});
|
||||
|
||||
$time = microtime(TRUE);
|
||||
Snowflake::app()->increment();
|
||||
if (empty($task->data)) {
|
||||
return $task->finish('null data');
|
||||
}
|
||||
|
||||
$time = microtime(TRUE);
|
||||
$finish = $this->runTaskHandler($task->data);
|
||||
if (!$finish) {
|
||||
$finish = [];
|
||||
|
||||
Reference in New Issue
Block a user