Skip to content

Commit

Permalink
fixed #3
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed May 17, 2024
1 parent e262eb8 commit bd8ad9d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Traits/ChannelMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
/**
* [
Expand All @@ -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), []);
Expand Down

0 comments on commit bd8ad9d

Please sign in to comment.