diff --git a/score/Core/App.php b/score/Core/App.php index dcc5d057..7b98d24e 100755 --- a/score/Core/App.php +++ b/score/Core/App.php @@ -144,13 +144,12 @@ public function catch() { * @param boolean $prepend * @return void */ - public function afterRequest(callable $callback, $prepend = true) { + public function afterRequest(callable $callback, $prepend = false) { if(is_callable($callback)) { Hook::addHook(Hook::HOOK_AFTER_REQUEST, $callback, $prepend); }else { throw new \Exception(__NAMESPACE__.'::'.__function__.' the first param of type is callable'); } - } /** diff --git a/score/Core/Cache/Redis.php b/score/Core/Cache/Predis.php old mode 100755 new mode 100644 similarity index 99% rename from score/Core/Cache/Redis.php rename to score/Core/Cache/Predis.php index 90d6c44c..3247ae7e --- a/score/Core/Cache/Redis.php +++ b/score/Core/Cache/Predis.php @@ -13,7 +13,7 @@ use Predis\Client; -class Redis { +class Predis { /** * $Predis redis实例 diff --git a/score/Core/Crontab/AbstractCronController.php b/score/Core/Crontab/AbstractCronController.php index 57a3ff9f..fe2823f9 100644 --- a/score/Core/Crontab/AbstractCronController.php +++ b/score/Core/Crontab/AbstractCronController.php @@ -38,7 +38,7 @@ abstract class AbstractCronController extends ProcessController { * runCron * @param string $expression cron的表达式 * @param callable $func 闭包函数 - * @return [type] [description] + * @return void */ public function runCron(string $expression, $func = null) { $expression_key = md5($expression); diff --git a/score/Core/Db/Mysql.php b/score/Core/Db/Mysql.php index c156c87d..72d94d13 100755 --- a/score/Core/Db/Mysql.php +++ b/score/Core/Db/Mysql.php @@ -129,6 +129,8 @@ public function setConfig(array $config = []) { $this->config = array_merge($this->default_config, $this->config); Db::setConfig($this->config); } + // set hook call + Application::getApp()->afterRequest([$this,'clear']); } /** @@ -246,8 +248,6 @@ public function selectMysql(array $extension = []) { public function __call($method, $args) { $this->setConfig(); $this->setCacheHandler(); - // set hook call - Application::getApp()->afterRequest([$this,'clear']); return Db::$method($args); } diff --git a/score/Core/Memory/ChannelManager.php b/score/Core/Memory/ChannelManager.php index b05d3a8c..80db5f7d 100644 --- a/score/Core/Memory/ChannelManager.php +++ b/score/Core/Memory/ChannelManager.php @@ -22,7 +22,7 @@ class ChannelManager { * @param string $name * @param int $size */ - public function addChannel(string $name, int $size = 1024 * 256) { + public function addChannel(string $name, int $size = 256 * 1024) { if(!isset($this->list[$name])) { $chan = new \Swoole\Channel($size); $this->list[$name] = $chan; diff --git a/score/Core/Pools/PoolsManager.php b/score/Core/Pools/PoolsManager.php index 3b4e1b44..40227014 100644 --- a/score/Core/Pools/PoolsManager.php +++ b/score/Core/Pools/PoolsManager.php @@ -403,7 +403,7 @@ public static function readByProcessName(string $name, float $timeOut = 0.1) { * getProcessInWorker 获取一个worker进程内的所有的PoolsProcess进程 * @return array */ - public function getProcessInWorker() { + public static function getProcessInWorker() { return self::$processList; } @@ -411,8 +411,8 @@ public function getProcessInWorker() { * killProcessInWorker 在一个worker内的PoolsProcess的进程退出,主要在workerstop中使用,由于PoolsProcess是产生于worker进程的,worker作为父进程,在退出是必须将子进程退出,否则成僵尸进程 * @return bool */ - public function killProcessInWorker() { - $processList = $this->getProcessInWorker(); + public static function killProcessInWorker() { + $processList = self::getProcessInWorker(); if($processList) { foreach($processList as $process) { $pid = $process->getPid(); @@ -421,6 +421,5 @@ public function killProcessInWorker() { } } return true; - } } \ No newline at end of file