eee
This commit is contained in:
+22
-23
@@ -14,21 +14,20 @@ namespace Database;
|
|||||||
use Database\Affair\BeginTransaction;
|
use Database\Affair\BeginTransaction;
|
||||||
use Database\Affair\Commit;
|
use Database\Affair\Commit;
|
||||||
use Database\Affair\Rollback;
|
use Database\Affair\Rollback;
|
||||||
|
use Database\Base\PDO;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Kiri;
|
|
||||||
use Kiri\Server\Events\OnWorkerExit;
|
|
||||||
use Kiri\Abstracts\Component;
|
use Kiri\Abstracts\Component;
|
||||||
use Kiri\Di\Context;
|
use Kiri\Di\Context;
|
||||||
use Kiri\Pool\Pool;
|
|
||||||
use Kiri\Events\EventProvider;
|
|
||||||
use Kiri\Error\StdoutLogger;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
use Kiri\Server\Events\OnWorkerStart;
|
|
||||||
use Kiri\Server\Events\OnTaskerStart;
|
|
||||||
use Kiri\Server\Events\OnAfterRequest;
|
|
||||||
use Kiri\Di\Inject\Container;
|
use Kiri\Di\Inject\Container;
|
||||||
|
use Kiri\Error\StdoutLogger;
|
||||||
|
use Kiri\Events\EventProvider;
|
||||||
|
use Kiri\Pool\Pool;
|
||||||
|
use Kiri\Server\Events\OnAfterRequest;
|
||||||
|
use Kiri\Server\Events\OnTaskerStart;
|
||||||
|
use Kiri\Server\Events\OnWorkerExit;
|
||||||
|
use Kiri\Server\Events\OnWorkerStart;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Swoole\Timer;
|
use Swoole\Timer;
|
||||||
use Database\Base\PDO;
|
|
||||||
|
|
||||||
//use PDO;
|
//use PDO;
|
||||||
|
|
||||||
@@ -134,19 +133,19 @@ class Connection extends Component
|
|||||||
protected function checkClientHealth(Pool $pool): void
|
protected function checkClientHealth(Pool $pool): void
|
||||||
{
|
{
|
||||||
$pool->flush($this->getName(), $this->pool['min'] ?? 1);
|
$pool->flush($this->getName(), $this->pool['min'] ?? 1);
|
||||||
$length = $pool->size($this->getName());
|
// $length = $pool->size($this->getName());
|
||||||
for ($i = 0; $i < $length; $i++) {
|
// for ($i = 0; $i < $length; $i++) {
|
||||||
try {
|
// try {
|
||||||
if (($client = $this->validator($pool)) === false) {
|
// if (($client = $this->validator($pool)) === false) {
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
$pool->push($this->getName(), $client);
|
// $pool->push($this->getName(), $client);
|
||||||
} catch (\Throwable $exception) {
|
// } catch (\Throwable $exception) {
|
||||||
if (!str_contains($exception->getMessage(), 'Client timeout.')) {
|
// if (!str_contains($exception->getMessage(), 'Client timeout.')) {
|
||||||
$this->logger->error(throwable($exception), [$this->cds]);
|
// $this->logger->error(throwable($exception), [$this->cds]);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user