Skip to content

Commit

Permalink
delete the old cache only if the kernel hasn't booted yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Niv authored and mmoreram committed Feb 15, 2021
1 parent 8f6891d commit aa2b3a3
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions AsyncKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@ public function boot()
{
if (!$this->booted) {
$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);
$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();
Expand Down

0 comments on commit aa2b3a3

Please sign in to comment.