You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Swoole event listener that requires the Swoole Event Dispatcher probably needs to implement EventDispatcherAwareInterface and have it set in \Mezzio\Swoole\Event\EventDispatcher::__construct looping through the provided listeners. Or lazier, in the \Mezzio\Swoole\Event\EventDispatcher::dispatch once the listener is identified for use.
This may be an untested path in Mezzio and be functional in the Phly codebase only. Can you confirm if this is tested to be working and if I am doing something wrong? It seems like an unavoidable circular dependency that makes this idea impossible to implement in its current state.
I realized that it makes more sense to have a separate TaskEventDispatcher rather than reusing the Mezzio\Swoole\Event\EventDispatcherInterface. I also found this in Mezzio\Swoole\Task\TaskEventDispatchListenerFactory.
If this is meant to be a separate event dispatcher, then my issue was caused by the fact that the docs don't state to configure a separate Task event dispatcher and the default behavior is to use Mezzio\Swoole\Event\EventDispatcher.
Bug Report
I am following the recommended way to run a task event listener, using a
TaskEventDispatchListener
, but have run into a DI loop.Mezzio\Swoole\Task\TaskEventDispatchListener
>Mezzio\Swoole\Event\EventDispatcherInterface
>Mezzio\Swoole\Event\SwooleListenerProvider
>Mezzio\Swoole\Task\TaskEventDispatchListener
.Summary
The following config results in memory exhaustion due to a circular dependency in DI.
Current behavior
Memory exhaustion due to circular dependency.
\Mezzio\Swoole\Event\EventDispatcherInterface
requested from container\Mezzio\Swoole\Event\EventDispatcherFactory
runs\Mezzio\Swoole\Event\SwooleListenerProvider
from the container\Mezzio\Swoole\Event\SwooleListenerProviderFactory
runs\Mezzio\Swoole\Task\TaskEventDispatchListener
\Mezzio\Swoole\Task\TaskEventDispatchListenerFactory
runsMezzio\Swoole\Event\EventDispatcherInterface
from containerHow to reproduce
Add this configuration, then attempt to get
\Mezzio\Swoole\Event\EventDispatcherInterface
from the container.The text was updated successfully, but these errors were encountered: