thomasjacquin/allsky-portal

Browser cache is filling up ?

mworion opened this issue · 5 comments

Hi,

first of all, many thanks for the great SW Package. I really like it. On observation I do: if you have the live view running for longer times, the browser (safari on MacBook Pro) tells extensive memory consumption. When I look to the console, I see the live Image objects continuously increasing. I had a quick look top the code and it might the case, that due to the reason that the live view filename changes continuously the browser cache fills up. Is there any chance to change this behavior and set the object as non cache ? I do not know how to do that. For mobile devices this might lead into problems. (at least I have such !)

Many thanks,

Michel

@mworion Unfortunately I don't know how to do it either, even though I've Googled it a couple times. The timestamp is added to the URL to keep the browser from looking in its cache instead of downloading the new image. I think what we need is a way to tell the browser to always download the image, but never store it in its cache.

I fixed it. You can pull and apply the patch with something iike this (the stuff after the # is just explaining what the command does):

ssh allsky                            # connect to your server
sudo apt install patch                # make sure you have the `patch` program
wget -O /tmp/cache.diff https://github.com/thomasjacquin/allsky/pull/512.diff # fetch the patch into /tmp
cd /etc/lighttpd                      # go into the lighttpd directory
patch --dry-run < /tmp/cache.diff     # check to make sure that the patch applies. do not proceed if this fails
sudo patch < /tmp/cache.diff          # actually apply the patch. do not proceed if this fails
sudo systemctl restart lighttpd       # restart web server to use the new settings

If sudo patch fails, you should be able to restore the previous configuration from /etc/lighttpd/lighttpd.conf.orig.

FYI - I already merged this into allsky, so you can use the normal upgrade.. er.. install method and get the fix.

Going forward, can we include a shell script with commands like this that a user can execute rather than executing every command separately (and risk making a mistake)? We'd also want to include error checking.