appstract / laravel-opcache

Laravel Package for OPcache
MIT License
1.33k stars 118 forks source link

opcache:optimize should be able to run whilst the application is down #53

Closed JackWH closed 6 years ago

JackWH commented 6 years ago

As part of my deployment process, I take the application offline with php artisan down before running the necessary tasks to deploy.

Before I bring it back up again with php artisan up, I'd like to be able to run php artisan opcache:optimize to pre-compile the opcache before visitors start using the site again.

If I try to do this, I get a 503 error returned through Artisan, as the application is in maintenance mode.

Can the opcache:optimize command whitelist itself anywhere in the CheckForMaintenanceMode class? Is this kind of thing possible?

ovanschie commented 6 years ago

From the package's perspective it is not really possible. You could write your own middleware to handle the MaintenanceMode or use a package like this https://github.com/MisterPhilip/maintenance-mode

But lets be honest, would you rather be a few seconds longer in Maintenance Mode than serve a site that is maybe 0.1s slower? I don't think it is worth the effort because the effect is minimal.

Closing it for now.