eee
This commit is contained in:
+3
-5
@@ -25,17 +25,15 @@ class Task
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*
|
||||
*/
|
||||
public function __construct(public ContainerInterface $container)
|
||||
public function __construct()
|
||||
{
|
||||
$exception = \config('exception.task');
|
||||
if (!in_array(ExceptionHandlerInterface::class, class_implements($exception))) {
|
||||
$exception = ExceptionHandlerDispatcher::class;
|
||||
}
|
||||
$this->exception = $this->container->get($exception);
|
||||
$this->exception = Kiri::getDi()->get($exception);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+9
-12
@@ -8,15 +8,6 @@ use Kiri\Server\ServerInterface;
|
||||
class TaskExecute implements TaskInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ServerInterface
|
||||
*/
|
||||
#[Container(ServerInterface::class)]
|
||||
public ServerInterface $server;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param float $timeout
|
||||
@@ -25,7 +16,9 @@ class TaskExecute implements TaskInterface
|
||||
*/
|
||||
public function taskWait(mixed $data, float $timeout = 0.5, int $dstWorkerId = -1): mixed
|
||||
{
|
||||
return $this->server->taskwait($data, $timeout, $dstWorkerId);
|
||||
$server = \Kiri::getDi()->get(ServerInterface::class);
|
||||
|
||||
return $server->taskwait($data, $timeout, $dstWorkerId);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +29,9 @@ class TaskExecute implements TaskInterface
|
||||
*/
|
||||
public function taskCo(array $tasks, float $timeout = 0.5): false|array
|
||||
{
|
||||
return $this->server->taskCo($tasks, $timeout);
|
||||
$server = \Kiri::getDi()->get(ServerInterface::class);
|
||||
|
||||
return $server->taskCo($tasks, $timeout);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +42,9 @@ class TaskExecute implements TaskInterface
|
||||
*/
|
||||
public function taskWaitMulti(array $tasks, float $timeout = 0.5): false|array
|
||||
{
|
||||
return $this->server->taskWaitMulti($tasks, $timeout);
|
||||
$server = \Kiri::getDi()->get(ServerInterface::class);
|
||||
|
||||
return $server->taskWaitMulti($tasks, $timeout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user