This commit is contained in:
as2252258@163.com
2021-07-11 03:57:25 +08:00
parent 27dc21e24e
commit 12d547c1a2
13 changed files with 1038 additions and 816 deletions
+4 -11
View File
@@ -18,15 +18,16 @@ class Channel extends Component
{
private static array $_channels = [];
private static ?array $_channels = [];
private static array $_waitRecover = [];
private static ?array $_waitRecover = [];
public function init()
{
Event::on(Event::SYSTEM_RESOURCE_RELEASES, [$this, 'recover']);
Event::on(Event::SERVER_WORKER_EXIT, [$this, 'cleanAll']);
}
@@ -84,15 +85,7 @@ class Channel extends Component
*/
public function cleanAll()
{
/** @var SplQueue $channel */
foreach (static::$_channels as $channel) {
if (!($channel instanceof SplQueue)) {
continue;
}
while ($channel->count() > 0) {
$channel->dequeue();
}
}
static::$_channels = null;
static::$_channels = [];
}