From bd8ad9dbd5c2ab8d3c8120cdd2fe6f4ba2c16e99 Mon Sep 17 00:00:00 2001 From: chaz6chez Date: Fri, 17 May 2024 15:48:12 +0800 Subject: [PATCH] fixed #3 --- src/Traits/ChannelMethods.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Traits/ChannelMethods.php b/src/Traits/ChannelMethods.php index bb4fc64..7001d06 100644 --- a/src/Traits/ChannelMethods.php +++ b/src/Traits/ChannelMethods.php @@ -142,7 +142,7 @@ protected static function _ChCreateListener(string $key, string|int $workerId, C throw new Error("Channel $key listener already exist. "); } self::_Atomic($key, function () use ( - $key, $workerId, $func, $params, &$result + $key, $workerId, $func, $params, $listener, &$result ) { /** * [ @@ -156,8 +156,9 @@ protected static function _ChCreateListener(string $key, string|int $workerId, C // 设置回调 $channel[$workerId]['futureId'] = + self::$_listenerCallbacks[$key] = $listener; self::$_listeners[$key] = - $result = Future::add(self::$_listenerCallbacks[$key] = function () use ($key, $workerId) { + $result = Future::add(function () use ($key, $workerId) { // 原子性执行 self::_Atomic($key, function () use ($key, $workerId) { $channel = self::_Get($channelName = self::GetChannelKey($key), []);