Page 1 of 1

Refresh Timer for template

Posted: Sat Jan 20, 2018 2:37 am
by Dehatter
I noticed that if I left the webpage open for an extended period of time, most of the blocks become stale. I added a timer so my page refreshes automatically every 30 mins (adjustable time). It is really easy to do, but would like some feedback before I share it.

Thanks!

Tom

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 9:36 am
by Jachym
Which blocks freeze? Most blocks are static, the few interactive ones (current etc.) should keep updating indefinitely

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 9:47 am
by Johnny
For me the block that doesn't update is 'stationData' I have to refresh the browser or select a new period from the stationData drop-down menu. I've always assumed that's the way this block is meant to work.

http://www.watfordweather.uk
http://www.watfordweather.co.uk

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 1:44 pm
by Jachym
No, not all blocks update, that would consume way too much resources

Blocks which update include current, gauges, steel series, some image blocks, webcam etc.

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 3:15 pm
by Dehatter
The following blocks do not update on a schedule that can can see:
Forecast
Meteogram
Air Quality
Station Status
Warnings
Station Records
Wind
World Weather
Earthquakes
Today

So rather than mess with putting a timer in all of them, I just refresh the page twice an hour. It is a single line of code.

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 3:21 pm
by Jachym
No those dont, I did not expect someone would be looking at the page for like an hour or so. Placig a timer would slow down the entire website a lot if every user triggered dozens of updates every few seconds

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 4:11 pm
by Dehatter
Well i don't stare at it for an hour, but I have left the page open...lol.

I agree most of them do not need updating every few seconds. A few updating would be helpful.

Trends Today Warnings wind stationstatus and stationaverages on the half hour

forecast meteogram stationrecords airquality much less frequently

windy times out after some period and goes away.

and at least once a day for the rest of them

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 4:39 pm
by Jachym
Hi,
this in my opinion is not very useful - once per day? That would assume you really keep looking at it for a day, the page being opened for a day or more. Every block auto-updates during each loding, so I really dont think many people spend more than a few seconds or max. minutes on the homepage before they go somewhere else on the website or elsewhere

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 4:39 pm
by Jachym
Every JS timer potentially slows the page down and considering the Pros and Cons Im not a big fan of this, those that really need updating - eg. the current and gauges, already have it

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 5:34 pm
by Lespius
Hi,
I input a line of code for an autorefresh as well, every 5 minutes. Mainly to refresh the interactive graph block.

Re: Refresh Timer for template

Posted: Sat Jan 20, 2018 8:18 pm
by Jachym
Yes, that will work of course and feel free to do so. It is not so elegant solution because the entire page has to reload, but it will do the trick. Probabyl easiest solution.