It is currently January 22nd, 2021, 3:56 pm

Webparser caching?

Report bugs with the Rainmeter application and suggest features.
drventure
Posts: 2
Joined: December 18th, 2020, 11:31 pm

Webparser caching?

Post by drventure »

Hi
New to rainmeter but I really like it so far.

I'm actually putting together a couple of simple skins to monitor a Jenkins build server as well as AzureDevops Git pull requests.

Both have relatively straightforward APIs, and once I got past the authentication bits, they seemed to work ok. or at least I thought so.

The Jenkins functionality is perfect, I'm actually pulling several web pages, parsing, and displaying graphs etc for them.

the Azure skin though is behaving VERY strangely.

I've got a URL that I'm using. It's working, in as much as it's returning some json data, but it's returning the WRONG data. as in, I can post the EXACT same url using postman, and I get a JSON array with 2 entries returned, which is correct.

I use that SAME url in rainmeter though and I get a JSON return value, but it contains different entries, as If I'm submitting a completely different set of query parameters to the URL

I'm completely stumped as to what might cause this. I've tried unloading, refreshing, unloading all other skins, restarting rainmeter etc, and I'm still getting the wrong results.

Here's the Measure definition for what it's worth.

Code: Select all

[MeasureMyPRs]
Measure=WebParser
URL=https://azuredevops.worksoft.com/#organization#/#project#/_apis/git/repositories/#repository#/pullrequests?api-version=5.1&searchCriteria.status=active&searchCriteria.creatorId=#MeasureUserID#
Header=Authorization:Basic #AzureDevOpsPATBase64#
RegExp=(?siU)#title##title##title##title##title#
Title uses the variable trick to allow parsing UP TO 5 entries, but dealing with the case where there might be fewer

title=(?(?=.*"title":".*").*"title":"(.*)")


I'm doing virtually identical things in my Jenkins skin and it works as expected.

Didn't see any mention on the forums of anything similar, so I thought I'd ask
Last edited by SilverAzide on December 19th, 2020, 12:32 am, edited 1 time in total.
Reason: Edit: Please use code tags. It's the </> button.
User avatar
SilverAzide
Rainmeter Sage
Posts: 1092
Joined: March 23rd, 2015, 5:26 pm

Re: Webparser caching?

Post by SilverAzide »

drventure wrote: December 18th, 2020, 11:43 pm <snip>
I'm doing virtually identical things in my Jenkins skin and it works as expected.

Didn't see any mention on the forums of anything similar, so I thought I'd ask
If you suspect caching, have you tried using the Flags option on the WebParser measure?

Code: Select all

[MeasureMyPRs]
Measure=WebParser
...
Flags=ForceReload | NoCacheWrite
Gadgets Wiki GitHub More Gadgets...
drventure
Posts: 2
Joined: December 18th, 2020, 11:31 pm

Re: Webparser caching?

Post by drventure »

Thanks for the response SilverAzide

I had not seen the Force option, tried in and still no luck.

This morning, it occurred to me to try and debug with Fiddler. See if there was anything anomalous about the request or response.

Loaded it up and immediately saw this.

https://azuredevops.worksoft.com/#organization#/#project#/_apis/git/repositories/#repository#/pullrequests?api-version=5.1&searchCriteria.reviewerId=

Of course, the #organization# etc vars were replaced, but what happened to the reviewerId?!@#$

Then it dawned on me,
1) I had just used [MeasureUserID], but to reference a measure value in a URL, you've gotta use [&MeasureUserID]. DOH!
2) even then, the userID was ending up blank, but that's because the two webrequests happen async, and the userID hasn't been resolved at the point the PullRequest query happens, so, blank UserID.


Long story short, a few Disabled=1 and FinishActions later, and I'm now resolving the PR request only after the UserID request has finished.

Awesome skinning app, though I do wish some of the parsing special cases (like the [&measure] stuff) could be eliminated.