diff --git a/AsyncKernel.php b/AsyncKernel.php index 959983a..239fd49 100644 --- a/AsyncKernel.php +++ b/AsyncKernel.php @@ -48,6 +48,16 @@ public function boot() $this->uid = $this->generateUID(); } + $fs = new Filesystem(); + // AsyncKernel loads the container only once when it loads. Storing it in the filesystem is not for cache purposes + // but more for using the same loading process as Kernel class use. + // Hence, everytime before AsyncKernel initiates the container it deletes the cache dir, + // to make sure it is building the updated kernel + $cachePath = $this->getCacheDir(); + if ($fs->exists($cachePath)) { + $fs->remove($cachePath); + } + parent::boot(); } @@ -177,26 +187,4 @@ public function processTimer(ContainerBuilder $container) $container->setDefinition(PeriodicTimer::class, $periodicTimer); } - - /** - * Initializes the service container. - * - * The cached version of the service container is used when fresh, otherwise the - * container is built. - */ - protected function initializeContainer() - { - $fs = new Filesystem(); - // AsyncKernel loads the container only once when it loads. Storing it in the filesystem is not for cache purposes - // but more for using the same loading process as Kernel class use. - // Hence, everytime before AsyncKernel initiates the container it deletes the cache dir, - // to make sure it is building the updated kernel - $cachePath = $this->getCacheDir(); - if ($fs->exists($cachePath)) { - $fs->remove($cachePath); - } - - // initialize the kernel - parent::initializeContainer(); - } }