改名
This commit is contained in:
@@ -6,10 +6,15 @@ use Http\Context\Context;
|
|||||||
use Kiri\Events\EventProvider;
|
use Kiri\Events\EventProvider;
|
||||||
use Kiri\Exception\RedisConnectException;
|
use Kiri\Exception\RedisConnectException;
|
||||||
use Kiri\Kiri;
|
use Kiri\Kiri;
|
||||||
|
use Kiri\Pool\StopHeartbeatCheck;
|
||||||
use Server\Events\OnWorkerExit;
|
use Server\Events\OnWorkerExit;
|
||||||
use Swoole\Timer;
|
use Swoole\Timer;
|
||||||
|
|
||||||
class Redis
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Redis implements StopHeartbeatCheck
|
||||||
{
|
{
|
||||||
|
|
||||||
const DB_ERROR_MESSAGE = 'The system is busy, please try again later.';
|
const DB_ERROR_MESSAGE = 'The system is busy, please try again later.';
|
||||||
@@ -69,7 +74,6 @@ class Redis
|
|||||||
try {
|
try {
|
||||||
if (env('state') == 'exit') {
|
if (env('state') == 'exit') {
|
||||||
echo 'timer end.' . PHP_EOL;
|
echo 'timer end.' . PHP_EOL;
|
||||||
$this->stopHeartbeatCheck();
|
|
||||||
}
|
}
|
||||||
if (time() - $this->_last > 10 * 60) {
|
if (time() - $this->_last > 10 * 60) {
|
||||||
$this->stopHeartbeatCheck();
|
$this->stopHeartbeatCheck();
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ class Pool extends Component
|
|||||||
}
|
}
|
||||||
while ($channel->length() > $retain_number) {
|
while ($channel->length() > $retain_number) {
|
||||||
$connection = $channel->pop();
|
$connection = $channel->pop();
|
||||||
if ($connection) {
|
if ($connection instanceof StopHeartbeatCheck) {
|
||||||
unset($connection);
|
$connection->stopHeartbeatCheck();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Kiri\Pool;
|
||||||
|
|
||||||
|
interface StopHeartbeatCheck
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public function stopHeartbeatCheck();
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user