改名
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Snowflake\Process;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Snowflake\Abstracts\Config;
|
use Snowflake\Abstracts\Config;
|
||||||
use Snowflake\Exception\ComponentException;
|
use Snowflake\Exception\ComponentException;
|
||||||
|
use Snowflake\Exception\ConfigException;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
use Swoole\Event;
|
use Swoole\Event;
|
||||||
@@ -58,15 +59,24 @@ class ServerInotify extends Process
|
|||||||
Event::add($this->inotify, [$this, 'check']);
|
Event::add($this->inotify, [$this, 'check']);
|
||||||
Event::wait();
|
Event::wait();
|
||||||
} else {
|
} else {
|
||||||
$this->loadByDir(APP_PATH . 'app');
|
$this->loadDirs();
|
||||||
$this->loadByDir(APP_PATH . 'routes');
|
|
||||||
$this->loadByDir(__DIR__ . '/../../');
|
|
||||||
|
|
||||||
$this->tick();
|
$this->tick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $isReload
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private function loadDirs($isReload = false)
|
||||||
|
{
|
||||||
|
foreach ($this->dirs as $value) {
|
||||||
|
$this->loadByDir(realpath($value), $isReload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private array $md5Map = [];
|
private array $md5Map = [];
|
||||||
|
|
||||||
|
|
||||||
@@ -78,9 +88,8 @@ class ServerInotify extends Process
|
|||||||
if ($this->isReloading) {
|
if ($this->isReloading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->loadByDir(APP_PATH . 'app', true);
|
|
||||||
$this->loadByDir(APP_PATH . 'routes', true);
|
$this->loadDirs(true);
|
||||||
$this->loadByDir(__DIR__ . '/../../', true);
|
|
||||||
|
|
||||||
Timer::after(2000, [$this, 'tick']);
|
Timer::after(2000, [$this, 'tick']);
|
||||||
}
|
}
|
||||||
@@ -201,9 +210,7 @@ class ServerInotify extends Process
|
|||||||
$this->trigger_reload();
|
$this->trigger_reload();
|
||||||
$this->int = -1;
|
$this->int = -1;
|
||||||
|
|
||||||
$this->loadByDir(APP_PATH . 'app');
|
$this->loadDirs();
|
||||||
$this->loadByDir(APP_PATH . 'routes');
|
|
||||||
$this->loadByDir(__DIR__ . '/../../');
|
|
||||||
|
|
||||||
$this->isReloading = FALSE;
|
$this->isReloading = FALSE;
|
||||||
$this->isReloadingOut = FALSE;
|
$this->isReloadingOut = FALSE;
|
||||||
@@ -241,7 +248,7 @@ class ServerInotify extends Process
|
|||||||
* @param $message
|
* @param $message
|
||||||
* @param $file
|
* @param $file
|
||||||
* @param $line
|
* @param $line
|
||||||
* @throws ComponentException
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function onErrorHandler($code, $message, $file, $line)
|
protected function onErrorHandler($code, $message, $file, $line)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user