diff --git a/src/Traits/ChannelMethods.php b/src/Traits/ChannelMethods.php index 5c7459e..677e734 100644 --- a/src/Traits/ChannelMethods.php +++ b/src/Traits/ChannelMethods.php @@ -109,18 +109,18 @@ protected static function _ChPublish(string $key, mixed $message, bool $store = else { // 非指定workerId if ($workerId === null) { - if ($store or isset($channel[$workerId]['futureId'])) { - $channel[$workerId]['value'][] = $message; - } - } - // 指定workerId - else { foreach ($channel as $workerId => $item) { if ($store or isset($item['futureId'])) { $channel[$workerId]['value'][] = $message; } } } + // 指定workerId + else { + if ($store or isset($channel[$workerId]['futureId'])) { + $channel[$workerId]['value'][] = $message; + } + } } self::_Set($channelName, $channel);