Skip to content

Commit

Permalink
fix: swoft-cloud/swoft/issues/1290 event error on concurrency requests
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed May 15, 2020
1 parent f279153 commit 6f50b7d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/event/src/Manager/EventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ public function trigger($event, $target = null, array $args = []): EventInterfac
return $isString ? $this->basicEvent : $event;
}

/** @var EventInterface $event */
if ($isString) {
$event = $this->events[$name] ?? $this->basicEvent;
// Use clone basic event object for fix coroutine error
$event = $this->events[$name] ?? clone $this->basicEvent;
}

// Initial value
/** @var EventInterface $event Initial value */
$event->setName($name);
$event->setParams($args);
$event->setTarget($target);
Expand Down Expand Up @@ -509,7 +509,6 @@ public function removeListener($listener, $event = null): bool
}
} else {
foreach ($this->listeners as $queue) {
/** @var $queue ListenerQueue */
$queue->remove($listener);
}
}
Expand Down

0 comments on commit 6f50b7d

Please sign in to comment.