image caching problem with Chrome

89 views
Skip to first unread message

Chris Richmond

unread,
Sep 22, 2019, 6:34:07 PM9/22/19
to weewx-user
All, this can't be a new thing, but using Chrome and weewx 3.9.1, the graphs don't reload when refreshing the
web page.  Rather than having to clear the image cache in Chrome's Settings, is it reasonable to add a trick like this:

This is from a different web published RPi dodad raspberryshake (mine is broken at the moment).  Anyhow, the trick
is to add a timestamp to the href that updates with the image so that it tricks the caching mechanism into reloading the
same named file when the timestamp has changed.  Does cheetah support that sort of thing?

Semi-unrelated, but is there a way to get the rsync report to run after the the images are generated rather than
before?  As it is, the images are always a cycle behind the rest of the page updates.  The report module isn't sorting
the names, but maybe naming rsync ZRSYNC and sorting the report names would work???

Sep 22 16:20:38 pivue weewx[30301]: copygenerator: copied 0 files to /home/weewx/public_html.vp2
Sep 22 16:25:14 pivue weewx[30301]: manager: Added record 2019-09-22 16:25:00 MDT (1569191100) to database 'weewx.sdb'
Sep 22 16:25:15 pivue weewx[30301]: manager: Added record 2019-09-22 16:25:00 MDT (1569191100) to daily summary in 'weewx.sdb'
Sep 22 16:25:16 pivue weewx[30301]: rsyncupload: rsync'd 23 files (168,268 bytes) in 0.96 seconds
Sep 22 16:25:32 pivue weewx[30301]: cheetahgenerator: Generated 9 files for report SeasonsReport in 14.57 seconds
Sep 22 16:25:38 pivue weewx[30301]: imagegenerator: Generated 14 images for SeasonsReport in 6.61 seconds
Sep 22 16:25:38 pivue weewx[30301]: copygenerator: copied 0 files to /home/weewx/public_html.vp2


thx,Chris 

Thomas Keffer

unread,
Sep 22, 2019, 8:05:53 PM9/22/19
to weewx-user
Take a look at this thread. It offers several solutions.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/e136d56f-7066-4c39-b433-c6a27f131d21%40googlegroups.com.

Chris Richmond

unread,
Sep 23, 2019, 10:02:59 AM9/23/19
to weewx-user
Thanks.  I don't think I have access to the web server config to go at it from that angle, but since I'm post-processing
all the web pages anyway to change host names, I can add the actual timestamps from the files while I'm at it.

Any other ideas on the report sequence?  I can fiddle with that when I get home.

Thx, Chris


On Sunday, September 22, 2019 at 5:05:53 PM UTC-7, Thomas Keffer wrote:
Take a look at this thread. It offers several solutions.

-tk
Semi-unrelated, but is there a way to get the rsync report to run after the the images are generated rather than
before?  As it is, the images are always a cycle behind the rest of the page updates.  The report module isn't sorting
the names, but maybe naming rsync ZRSYNC and sorting the report names would work???

Sep 22 16:20:38 pivue weewx[30301]: copygenerator: copied 0 files to /home/weewx/public_html.vp2
Sep 22 16:25:14 pivue weewx[30301]: manager: Added record 2019-09-22 16:25:00 MDT (1569191100) to database 'weewx.sdb'
Sep 22 16:25:15 pivue weewx[30301]: manager: Added record 2019-09-22 16:25:00 MDT (1569191100) to daily summary in 'weewx.sdb'
Sep 22 16:25:16 pivue weewx[30301]: rsyncupload: rsync'd 23 files (168,268 bytes) in 0.96 seconds
Sep 22 16:25:32 pivue weewx[30301]: cheetahgenerator: Generated 9 files for report SeasonsReport in 14.57 seconds
Sep 22 16:25:38 pivue weewx[30301]: imagegenerator: Generated 14 images for SeasonsReport in 6.61 seconds
Sep 22 16:25:38 pivue weewx[30301]: copygenerator: copied 0 files to /home/weewx/public_html.vp2


thx,Chris 

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

gjr80

unread,
Sep 23, 2019, 8:04:20 PM9/23/19
to weewx-user
Hi,

Reports are processed in the order listed in weewx.conf under [StdReport], have a look under [StdReport], is [[RSYNC]] before or after [[SeasonsReport]]? Based on the log extract provided I am guessing it is before. If so try moving then entire [[RSYNC]] stanza to be after (the entire) [[SeasonsReport]] stanza. If [[RSYNC]] is indeed after [[SeasonsReport]] then post a copy of your [StdReport] stanza (if you do make sure any passwords, user names or other sensitive info is obfuscated). Note you will need to restart WeeWX or do a config reload for any weewx.conf changes to take effect.

As an aside a similar ordered approach is taken within each skin. In the skin config file, skin.conf, the generators are run in the order they are listed; normally the Cheetah generator first to produce template based reports then the Image generator to produce plots. Within each of these generators the reports and plots are produced in the order listed.

Gary

Chris Richmond

unread,
Sep 24, 2019, 11:09:18 AM9/24/19
to weewx-user
Thanks, it was the first enabled report in the list.  I've moved it to the end now.  The config setup is mostly the default for 3.9.1
for a Vantage station.

Chris

Pat

unread,
Sep 25, 2019, 10:10:55 PM9/25/19
to weewx-user
> This is from a different web published RPi dodad raspberryshake (mine is broken at the moment).  Anyhow, the trick is to add a timestamp to the href that updates with the image so that it tricks the caching mechanism into reloading the same named file when the timestamp has changed.  Does cheetah support that sort of thing?

Yes, Cheetah supports it. I use this trick in my Belchertown skin to prevent caching. Here's how you can use it too. 

This is NOT TESTED on Seasons, so be sure to have a backup. Find the images you want to stop caching for. For example inside the index.html.tmpl. Add this to the end of the image src: ?v=#echo int( time.time() ) #

For example in a full line:

<img src="daybarometer.png?v=#echo int( time.time() ) #" alt="$obs.label.barometer"/>

That'll change the img src to have a timestamp at the end, similar to your a href you have mentioned. The timestamp will not be when you refresh the page, but rather the time when weewx generated the index.html page. So it should update every archive interval with a new timestamp appended. 
Reply all
Reply to author
Forward
0 new messages