From 1349079f59f3810a91b54a2361069f5f652d8e5a Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 8 Aug 2019 14:08:39 +0200 Subject: [PATCH] Updated TaskRunner and ListenerProvider so that they are lazyly created, preventing the Swoole server to be created more than once --- .../config/event_dispatcher.config.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/module/EventDispatcher/config/event_dispatcher.config.php b/module/EventDispatcher/config/event_dispatcher.config.php index 336162b8..ed932155 100644 --- a/module/EventDispatcher/config/event_dispatcher.config.php +++ b/module/EventDispatcher/config/event_dispatcher.config.php @@ -5,6 +5,7 @@ namespace Shlinkio\Shlink\EventDispatcher; use Phly\EventDispatcher as Phly; use Psr\EventDispatcher as Psr; +use Zend\ServiceManager\Proxy\LazyServiceFactory; return [ @@ -21,6 +22,16 @@ return [ 'aliases' => [ Psr\EventDispatcherInterface::class => Phly\EventDispatcher::class, ], + 'delegators' => [ + Psr\ListenerProviderInterface::class => [ + LazyServiceFactory::class, + ], + ], + 'lazy_services' => [ + 'class_map' => [ + Psr\ListenerProviderInterface::class => Psr\ListenerProviderInterface::class, + ], + ], ], ];