Compare commits

..

3 Commits

Author SHA1 Message Date
as2252258 3110e69350 改名 2021-11-19 17:11:17 +08:00
as2252258 4862e7e913 改名 2021-11-19 14:49:22 +08:00
as2252258 0a52bd502b 改名 2021-11-19 12:28:08 +08:00
2 changed files with 14 additions and 31 deletions
+13 -24
View File
@@ -5,8 +5,9 @@ namespace Kiri\Error;
use Exception;
use Http\Aspect\OnAspectInterface;
use Http\Aspect\OnJoinPointInterface;
use Http\Constrict\RequestInterface;
use Kiri\IAspect;
use Kiri\Kiri;
@@ -14,20 +15,24 @@ use Kiri\Kiri;
* Class LoggerAspect
* @package Kiri\Error
*/
class LoggerAspect implements IAspect
class LoggerAspect implements OnAspectInterface
{
private float $time;
/**
* @param mixed $handler
* @param array $params
* @param OnJoinPointInterface $joinPoint
* @return mixed
* @throws Exception
*/
public function invoke(mixed $handler, array $params = []): mixed
public function process(OnJoinPointInterface $joinPoint): mixed
{
return call_user_func($handler, ...$params);
$time = microtime(true);
$response = $joinPoint->process();
$this->print_runtime($time);
return $response;
}
@@ -44,20 +49,4 @@ class LoggerAspect implements IAspect
echo PHP_EOL;
}
public function before(): void
{
// TODO: Implement before() method.
$this->time = microtime(true);
}
/**
* @throws Exception
*/
public function after(mixed $response): void
{
// TODO: Implement after() method.
$this->print_runtime($this->time);
}
}
+1 -7
View File
@@ -47,9 +47,6 @@ class Inotify
public function clear()
{
Event::del($this->inotify);
var_dump('clear event');
Event::exit();
}
@@ -76,10 +73,7 @@ class Inotify
}
//非重启类型
if (str_ends_with($ev['name'], '.php')) {
if ($this->process->int !== -1) {
return;
}
usleep(200);
sleep(2);
$this->reload();
}
}