Revert "改名"

This reverts commit fdf58326
This commit is contained in:
2022-01-20 19:04:16 +08:00
parent 862acf1db1
commit b557f15a98
7 changed files with 15 additions and 17 deletions
-7
View File
@@ -45,8 +45,6 @@ class Redis implements StopHeartbeatCheck
private int $_last = 0;
private EventProvider $eventProvider;
/**
* @param array $config
@@ -67,9 +65,6 @@ class Redis implements StopHeartbeatCheck
public function init()
{
$this->heartbeat_check();
$this->eventProvider = Kiri::getDi()->get(EventProvider::class);
$this->eventProvider->on(OnWorkerExit::class, [$this, 'onWorkerExit']);
}
@@ -110,8 +105,6 @@ class Redis implements StopHeartbeatCheck
if (time() - $this->_last > intval($this->pool['tick'] ?? 60)) {
$this->stopHeartbeatCheck();
$this->eventProvider->off(OnWorkerExit::class, [$this, 'stopHeartbeatCheck']);
$this->pdo = null;
}
} catch (\Throwable $throwable) {
+6 -1
View File
@@ -19,6 +19,8 @@ use Kiri;
use Kiri\Pool\Redis as PoolRedis;
use Kiri\Annotation\Inject;
use Kiri\Server\Events\OnWorkerExit;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Swoole\Timer;
/**
@@ -43,7 +45,10 @@ class Redis extends Component
/**
* @return void
* @throws ConfigException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws Exception
*/
public function init()
@@ -54,7 +59,7 @@ class Redis extends Component
$length = Config::get('cache.redis.pool.max', 10);
$this->eventProvider->on(OnWorkerExit::class, [$this, 'destroy'], 0);
$this->getEventProvider()->on(OnWorkerExit::class, [$this, 'destroy'], 0);
$connections->initConnections('Redis:' . $config['host'], true, $length);
}