Skip to content

Commit 7364611

Browse files
authored
[Bug] Wrap system maintenance commands in try to soft fail the command (alexjustesen#1097)
1 parent 152e9c5 commit 7364611

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

app/Console/Commands/SystemMaintenance.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Console\Command;
66
use Illuminate\Support\Facades\Artisan;
7+
use Illuminate\Support\Facades\Log;
78

89
class SystemMaintenance extends Command
910
{
@@ -36,8 +37,20 @@ public function handle()
3637
*/
3738
protected function refreshCache(): void
3839
{
39-
Artisan::call('optimize:clear');
40+
try {
41+
Artisan::call('optimize:clear');
42+
} catch (\Throwable $th) {
43+
Log::info('System maintenance failed to clear the cache.');
4044

41-
Artisan::call('optimize');
45+
return;
46+
}
47+
48+
try {
49+
Artisan::call('optimize');
50+
} catch (\Throwable $th) {
51+
Log::info('System maintenance failed to fresh the cache.');
52+
53+
return;
54+
}
4255
}
4356
}

0 commit comments

Comments
 (0)