-
Notifications
You must be signed in to change notification settings - Fork 0
Warning thrown once maintenance file deleted #3
Comments
Anyone there? :) |
Sorry Matt, I looked at the time and didn't have a solution. Calling |
Yeah it doesn’t strike me as particularly elegant either, though it’s not the whole stat cache, at least. The only other way I can think of dealing with it is by telling users to delete the maintenance file using PHP (
|
That wouldn't clear the stat cache for all fpm workers though, only the one that happened to do the unlinking. |
Well… poop. Short of restarting php-fpm, I’m out of ideas! |
Let's go with the inelegant solution then! $path = realpath($this->path);
if (false !== $path) {
clearstatcache(true, $path);
if (false !== realpath($path)) {
return new Response(file_get_contents($path), 503);
}
} |
Works for me! And no additional load when out of maintenance is plenty elegant enough for me. Thanks <3 |
With the PHP-FPM sapi (possibly with others), the PHP stat cache persists at least long enough that the realpath test in https://github.com/atst/stack-backstage/blob/master/src/Atst/StackBackstage.php#L21 will return true after the file is removed/renamed, resulting in the subsequent
file_get_contents()
call throwing an error.I'm not sure what the best solution is. One is to
clearstatcache(true, $this->path)
just beforerealpath
- but even though it's only clearing one file's realpath stats, it might still have a performance penalty.Happy to submit a pull request if this solution is acceptable.
The text was updated successfully, but these errors were encountered: