Skip to content

Commit aa2b3a3

Browse files
Nivmmoreram
authored andcommitted
delete the old cache only if the kernel hasn't booted yet
1 parent 8f6891d commit aa2b3a3

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

AsyncKernel.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,15 @@ public function boot()
4646
{
4747
if (!$this->booted) {
4848
$this->uid = $this->generateUID();
49-
}
50-
51-
$fs = new Filesystem();
52-
// AsyncKernel loads the container only once when it loads. Storing it in the filesystem is not for cache purposes
53-
// but more for using the same loading process as Kernel class use.
54-
// Hence, everytime before AsyncKernel initiates the container it deletes the cache dir,
55-
// to make sure it is building the updated kernel
56-
$cachePath = $this->getCacheDir();
57-
if ($fs->exists($cachePath)) {
58-
$fs->remove($cachePath);
49+
$fs = new Filesystem();
50+
// AsyncKernel loads the container only once when it loads. Storing it in the filesystem is not for cache purposes
51+
// but more for using the same loading process as Kernel class use.
52+
// Hence, everytime before AsyncKernel initiates the container it deletes the cache dir,
53+
// to make sure it is building the updated kernel
54+
$cachePath = $this->getCacheDir();
55+
if ($fs->exists($cachePath)) {
56+
$fs->remove($cachePath);
57+
}
5958
}
6059

6160
parent::boot();

0 commit comments

Comments
 (0)