laouch's avatar

Randomly get a blank view when I upload a blade file to the server

Hello,

as the title say I have this small bug, since I upgraded to Laravel 5.8, when I update a view and upload the file (by sftp) to the server, 75% (I would say) of the time I get a blank page or a blank view and I have to re-upload right away 2 or 3 times until it show the full file.

Its not a server issue or a CHMOD issue, the file on the server is the exact same size as the local file and I only get this bug with blade file, It also seem to happen more on the websites where I have huge traffic...

My guess would be that the blank view is a result of a cache system who see a change in filesize and so choose to cache the view before the upload is finish..

Is this a know issue ? Is there a fix ? (I dont want to upgrade Laravel)

0 likes
7 replies
Snapey's avatar

clear the views cache when dropping in new files

php artisan view:clear

1 like
laouch's avatar

@Snapey thank you, I do it already sometime but at this point its faster for me to re-upload my files.

What I dont get is why the cache of the view is updated when the filesize is at 0 (when I start the upload) but not later when the file is bigger, it doesnt make sens.

laouch's avatar

@Snapey thank you, I will try to add a filesize there to force it to wait the end of the upload. Thank again for your help.

Snapey's avatar

@laouch No, never edit the vendor file. You should check for the time difference. You can get your new file to take by adjusting its timestamp to a time that makes it newer. Ideally make the server and your local dev have the same time

Or, clear the view cache at every upload.

laouch's avatar

@Snapey but whatever timestamp I use, that doesn't prevent the file to be cached before the end of the upload, I will still need to re-upload a few times. I dont have the issue on small websites because no one is visiting / "querying" the file while its still uploading.

Clearing the view cache seem to be the only solution.

Snapey's avatar

@laouch Or adopt a better deployment strategy than 'hot patching' the server.

I use a simple bash script that creates a copy of the site and then flips the web server from one folder to another.

Please or to participate in this conversation.