It is currently July 7th, 2020, 3:15 am

Update rates

Get help with installing and using Rainmeter.
ms310
Posts: 224
Joined: April 1st, 2015, 7:16 am

Update rates

Post by ms310 »

Hi - I am trying to sort out the update rates for my skin.

Main Skin - I would like the skin to update every 20 minutes

Code: Select all

Update=1000
DefaultUpdateDivider=1200
Weather Measures (WebParser) - Since this is called by the Main Skin, do I even need this here? Should it be -1?

Code: Select all

UpdateRate=1200
Timezone Measures (WebParser) - Also called by the Main Skin. I want this to update only ONCE when the skin in updated - since it is TIME I am not really that concerned with it updating all the time. Yes, on the DAYS that Daylight Savings Time changes I understand unless I force an update the timezones could be off. Would this be better to be 86400 for "once a day"?

Code: Select all

UpdateDivider=-1
Thanks for the help in sorting this out.
mak_kawa
Posts: 717
Joined: December 30th, 2015, 9:47 am

Re: Update rates

Post by mak_kawa »

Hi ms310

As described in the Rainmeter documents, update cycle of the WebParser measure is defined as Update X UpdateDivider X UpdateRate = "how often the measure connects to the site".

So in your case, update cycle is 1000*1200*1200 = 1440000000 msec = 1440000 seconds = about 40 hours. sorry mistake, = 400 hours = about 17 days. :o

I think UpdateDivider=-1 works as you intend, the measure is updated at only skin refresh.

If I am misunderstanding, sorry.
ms310
Posts: 224
Joined: April 1st, 2015, 7:16 am

Re: Update rates

Post by ms310 »

Thanks, mak_kawa - this helped me out.

I ended up with the following:

Main Skin

Code: Select all

Update=1000
DefaultUpdateDivider=600
Result: updates every 10 minutes

Weather Measures (WebParser) - called by Main Skin

Code: Select all

UpdateRate=2
Result: updates every 20 minutes

Timezone Measures (WebParser) - called by Main Skin

Code: Select all

UpdateRate=-1
Result: updates only ONCE

Thanks!
User avatar
balala
Rainmeter Sage
Posts: 10968
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Update rates

Post by balala »

ms310 wrote:
June 23rd, 2020, 4:38 am
Timezone Measures (WebParser) - called by Main Skin

Code: Select all

UpdateRate=-1
Result: updates only ONCE
Note that UpdateRate=-1 makes no sens, it's not valid: https://forum.rainmeter.net/viewtopic.php?f=5&t=33606&start=40#p166347
Instead of setting the UpdateRate to -1, set the UpdateDivider to -1.
mak_kawa
Posts: 717
Joined: December 30th, 2015, 9:47 am

Re: Update rates

Post by mak_kawa »

Hi balala and ms310

Surely jsmorley has stated as the "UpdateRate=nnnn" value can't be -1... But I found UpdateRate=-1 in the sample code of tips for Network Skin of the Rainmeter documents...What is this? Typo?! :-)
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Update rates

Post by jsmorley »

mak_kawa wrote:
June 23rd, 2020, 9:32 am
Hi balala and ms310

Surely jsmorley has stated as the "UpdateRate=nnnn" value can't be -1... But I found UpdateRate=-1 in the sample code of tips for Network Skin of the Rainmeter documents...What is this? Typo?! :-)
Yes, that really is a typo, and I will fix it. That should be UpdateDivider=-1
mak_kawa
Posts: 717
Joined: December 30th, 2015, 9:47 am

Re: Update rates

Post by mak_kawa »

Hi jsmorley

Thank you for quick clarification.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Update rates

Post by jsmorley »

This is a bit of a slippery subject.

In fact, if you want to have a WebParser measure update once when the skin loads/refreshes, but not again, you CAN use UpdateRate=-1, and it will have that effect. If you instead use UpdateDivider=-1, that will have exactly the same result.

However, UpdateDivider=-1 does fly in the face of the often-given advice to NEVER use UpdateDivider on a WebParser measures, but rather to control the rate that it is updated with UpdateRate. Remember that the ONLY purpose of any "update" to to a WebParser measure is to increment the counter inside of WebParser that is set by UpdateRate. Nothing is going to happen until the value of UpdateRate is reached by the counter and it resets to zero.

In a strictly technical sense, UpdateRate=-1 is not supported. This is due to the fact that the type of number used for the counter inside of WebParser does not support negative numbers. However, due to a quirk of the C language, what happens when you use a negative number with UpdateRate is that it circles around the universe of numbers and you end up with it seeing the value as the maximum value for a 32bit integer, which is just a gigantic number. So the net effect is that WebParser will update once, and then not again for something like 132 years... This does no harm, and for all practical purposes it works as intended. You are pretty likely to reboot your system sometime in the next 132 years.

So I'm torn on the advice to give. I have often said that you should stay completely away from UpdateDivider on WebParser measures, as with the nature of the relationship between UpdateDivider and UpdateRate, it only risks causing "lag", and adds no benefit. On the other hand, UpdateRate=-1, while more or less having the desired effect, is technically an error.

In a technically correct sense, you should probably use UpdateRate=604800 or some other huge number to get WebParser to update only once. With that number, it will update once a week. UpdateDivider=-1, while being technically correct, can cause some confusion with the general advice about UpdateDivider and WebParser.

So either way I guess. Personally, I lean toward UpdateRate=-1. This is because I am always hesitant to use or recommend UpdateDivider on WebParser, and the -1 bit is sorta logical and easy to remember, since it is the same value you would use for this effect with UpdateDivider.

You are likely to see somewhat conflicting advice on this in various places in the forums and documentation, as it was only recently that I realized that UpdateRate=-1 would actually work more or less as intended, and wasn't just a flat-out error. Besides that, which way I lean on this question kinda depends on which side of the bed I got up on this morning. Fortunately, it is very seldom indeed that you want a WebParser measure to only go out to the resource one time.
mak_kawa
Posts: 717
Joined: December 30th, 2015, 9:47 am

Re: Update rates

Post by mak_kawa »

Hi jsmorley

"Slippery"... indeed. :-) Appreciate your frank explanation.
SCR
Posts: 51
Joined: April 15th, 2015, 11:13 pm

Re: Update rates

Post by SCR »

Whew.. I thought I had lost it there for a while as I use the UpdateRate=-1 on few "Once and Done" URL's I was just about to change them. Thanks for the clarification.