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