eee
This commit is contained in:
+5
-2
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Kiri\Router;
|
namespace Kiri\Router;
|
||||||
|
|
||||||
|
use Kiri\Abstracts\CoordinatorManager;
|
||||||
|
use Kiri\Coordinator;
|
||||||
use Kiri\Di\Inject\Container;
|
use Kiri\Di\Inject\Container;
|
||||||
use Kiri\Di\Context;
|
use Kiri\Di\Context;
|
||||||
use Kiri\Di\Interface\ResponseEmitterInterface;
|
use Kiri\Di\Interface\ResponseEmitterInterface;
|
||||||
@@ -77,8 +79,9 @@ class OnRequest implements OnRequestInterface
|
|||||||
try {
|
try {
|
||||||
$PsrRequest = $this->initRequestAndResponse($request);
|
$PsrRequest = $this->initRequestAndResponse($request);
|
||||||
|
|
||||||
$PsrResponse = $this->router->query($request->server['path_info'], $request->getMethod())
|
CoordinatorManager::utility(Coordinator::WORKER_START)->yield();
|
||||||
->run($PsrRequest);
|
|
||||||
|
$PsrResponse = $this->router->query($request->server['path_info'], $request->getMethod())->run($PsrRequest);
|
||||||
} catch (Throwable $throwable) {
|
} catch (Throwable $throwable) {
|
||||||
$PsrResponse = $this->exception->emit($throwable, $this->constrictResponse);
|
$PsrResponse = $this->exception->emit($throwable, $this->constrictResponse);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
+8
-1
@@ -5,6 +5,8 @@ namespace Kiri\Router;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Kiri;
|
use Kiri;
|
||||||
|
use Kiri\Abstracts\CoordinatorManager;
|
||||||
|
use Kiri\Coordinator;
|
||||||
use Kiri\Router\Validator\ValidatorMiddleware;
|
use Kiri\Router\Validator\ValidatorMiddleware;
|
||||||
use Kiri\Router\Base\Middleware as MiddlewareManager;
|
use Kiri\Router\Base\Middleware as MiddlewareManager;
|
||||||
use Kiri\Router\Constrict\RequestMethod;
|
use Kiri\Router\Constrict\RequestMethod;
|
||||||
@@ -174,12 +176,17 @@ class Router
|
|||||||
*/
|
*/
|
||||||
public function scan_build_route(): void
|
public function scan_build_route(): void
|
||||||
{
|
{
|
||||||
|
$coordinator = CoordinatorManager::utility(Coordinator::WORKER_START);
|
||||||
|
$coordinator->waite();
|
||||||
|
|
||||||
$this->read_dir_file(APP_PATH . 'routes');
|
$this->read_dir_file(APP_PATH . 'routes');
|
||||||
|
|
||||||
$container = Kiri::getDi();
|
$container = Kiri::getDi();
|
||||||
$scanner = di(Kiri\Di\Scanner::class);
|
$scanner = $container->get(Kiri\Di\Scanner::class);
|
||||||
$scanner->load_directory(APP_PATH . 'app/Controller');
|
$scanner->load_directory(APP_PATH . 'app/Controller');
|
||||||
$this->reset($container);
|
$this->reset($container);
|
||||||
|
|
||||||
|
$coordinator->done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user