改名
This commit is contained in:
+16
-14
@@ -49,23 +49,25 @@ class Connection extends Pool
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this->lastTime + 600 < time()) {
|
if ($this->lastTime + 600 < time()) {
|
||||||
$channels = $this->getChannels();
|
$this->flush(1);
|
||||||
foreach ($channels as $name => $channel) {
|
|
||||||
while ($channel->length() > 0) {
|
|
||||||
$channel->pop();
|
|
||||||
$this->desc($name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ($this->lastTime + 500 < time()) {
|
} else if ($this->lastTime + 500 < time()) {
|
||||||
$channels = $this->getChannels();
|
$this->flush(5);
|
||||||
foreach ($channels as $name => $channel) {
|
}
|
||||||
while ($channel->length() > 5) {
|
}
|
||||||
$channel->pop();
|
|
||||||
$this->desc($name);
|
|
||||||
}
|
/**
|
||||||
|
* @param $retain_number
|
||||||
|
*/
|
||||||
|
protected function flush($retain_number)
|
||||||
|
{
|
||||||
|
$channels = $this->getChannels();
|
||||||
|
foreach ($channels as $name => $channel) {
|
||||||
|
while ($channel->length() > $retain_number) {
|
||||||
|
$channel->pop();
|
||||||
|
$this->desc($name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user