It is currently July 26th, 2024, 11:40 pm

Bug+Feature: make WebParser reload files after failure

Report bugs with the Rainmeter application and suggest features.
osman-pasha
Posts: 3
Joined: November 20th, 2009, 5:24 pm

Bug+Feature: make WebParser reload files after failure

Post by osman-pasha »

Hi! I've got a suggestion for a WebParser plugin.
I've noticed this behaviour in rainmeter: if webparser could not load files from internet (e.g some temporary internet problems) it will make another attempt in several hours (e.g. in MoxaWeather, half an hour by default). If this failed attempt was the first after start, then for some hours you'll see empty places for these skins. It s better for it to make some frequent attempts after a failure, just to show a right information in case internet problems disappear.

I noticed it this way:
To turn on internet I have to launch a program manually (that's my ISP madness%), so just after my PC starts, i have no internet. Rainmeter (which is in autostart) cannot fetch weather from internet (and also rss, atom etc). So for several hours I see some empty areas where weather and feeds should be.

I've just made a fix to webparser plugin to refetch files more repidly if the last attemp to download failed. I've added new option for WebParser plugin (UpdateFailRate, which is similar to UpdateRate). It is used to count ticks instead of UpdateRate when last fetching failed. (I've defaulted it to 10 while UpdateRate is 600 by default)
It solved my problem, now i'm happy to see it working, so i decided to contribute this.

Attached .cpp file and .diff to the current (315) revision
WebParserChange.zip
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: Bug+Feature: make WebParser reload files after failure

Post by kenz0 »

I feel that your proposal has a little danger with the advantage.

Some web services often blocks the access of the user by some kind of reasons. There is a valid reason in these acts and this is a server's self-defense measure. If we do not understand this, and the access is repeated frequently, the significant damage might be given to the server.
For example, a server is temporarily busy, and when not returning a response, it means that our access increases further as a result, and a server is made more busy.
Surely I know that updateFailRate does not work dangerous with your personal case. But we can also expect the case which carries out negative behavior like the above example.
We must consider the possibility that updateFailRate works as a poison.
Basically, we the developer tends to regard one danger as important than 100 convenience. Personally, I do not have an affirmative thought to providing with such a function all the users including an entry user.

However, if a user still desires solution of a problem like your case, I can propose the easy workaround by the following config work.

----------------------------------------------------------
[MeasureInternet]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=10
Url=http://...
RegExp=...
FinishAction=!RainmeterDisableMeasure MeasureInternet

[MeasureUpdate]
Measure=Calc
Format=Counter % 600
IfEqualValue=599
IfEqualAction=!RainmeterEnableMeasure MeasureInternet
----------------------------------------------------------

[MeasureInternet] is updated every 10 seconds until download is successful and activity is stopped after download is successful.
Usual UpdateRate is defined by [MeasureUpdate] and activity of [MeasureInternet] is resumed by this measure.
.
Image
osman-pasha
Posts: 3
Joined: November 20th, 2009, 5:24 pm

Re: Bug+Feature: make WebParser reload files after failure

Post by osman-pasha »

Yeah, the danger sounds reasonable, so I can suggest a modification for the concept: set default UpdateFailRate to the same value as UpdateRate, then the program will behave with no difference to current version, if skin itself does not assign UpdateFailRate a smaller value. This means that the feature will be off by default. If any user wants to "turn on" this option, he should include this option in skin .ini file with a smaller value (from 10sec to 10min seems reasonable to me).

Sorry to say this, but your solution with additional Meter seems kinda bulky and requires a lot of text to write while giving the same result as adding one line to the configs. It also requires some deep knowledge about Calc meter and I think that shouldn't be needed to fix a WebParser behaviour.
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Bug+Feature: make WebParser reload files after failure

Post by dragonmage »

Your case seems like it will be a fairly rare issue and I would like to suggest a solution that has nothing to do with Rainmeter.

Startup Delayer

It manages your startup items, allowing you to control which ones start and when. You could use it to start your ISP app before Rainmeter starts, to be sure there is a connection for Rainmeter to use.
osman-pasha
Posts: 3
Joined: November 20th, 2009, 5:24 pm

Re: Bug+Feature: make WebParser reload files after failure

Post by osman-pasha »

Er dragonmage, probably you dont understand the case. I've got my issue solved already by modyfying a bit of source code. And now I want to apply a patch to official release so that anyone who has the same problem will cope with it with much less effort. Consider this as a minor feature addition.