Hopefully an easy one...
I have a WebParser measure that updates every second, but will sometimes return no results (the servers fault, can't be helped).
Q. To prevent my meter constantly flashing between displaying data and no data, is there a way I can have the last value read from WebParser persist if no data is read?
It is currently April 19th, 2024, 11:46 am
Don't update measure if no data can be read?
-
- Posts: 14
- Joined: February 19th, 2019, 2:15 pm
-
- Rainmeter Sage
- Posts: 5391
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Don't update measure if no data can be read?
Would need to see your code because normally the Webparser DOES remember the last successful parse data.JayOtt wrote: ↑February 20th, 2019, 10:14 am Hopefully an easy one...
I have a WebParser measure that updates every second, but will sometimes return no results (the servers fault, can't be helped).
Q. To prevent my meter constantly flashing between displaying data and no data, is there a way I can have the last value read from WebParser persist if no data is read?
Rainmeter Manual (*);;If a WebParser measure is able to connect and parse information from a web site or file, then that information is "remembered", and is only replaced when new information is successfully received on subsequent connections to the resource. This is both to allow a seamless transition from the old data to the new, and to allow a skin to continue displaying information if it is temporarily unable to connect or parse the resource.
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Don't update measure if no data can be read?
I agree with eclectic-tech, but in addition I'd add that update the parent WebParser measure once per second is too much. Unless what you access through the measure is a local resource (a file on your computer) updating a WebParser measure so frequently isn't a good idea. Read the Note here.
-
- Posts: 14
- Joined: February 19th, 2019, 2:15 pm
Re: Don't update measure if no data can be read?
Cool, yeah, here's the code:
Occasionally the website fails and displays an error instead of the numbers I'm after... so WebParser here fails and becomes empty.
The only reason update is on 1 second is so I don't spend long peoples looking at no data when the above failure happens.
Code: Select all
[MeasureState]
Measure=WebParser
URL=http://URLThatGivesYouCommaDelinatedNumbers.com
RegExp=(?siU),(.*),.*(.*),.*(.*),.*(.*),.*(.*),.*(.*),.*(..)
UpdateRate=1
[MeasureCurrTime]
Measure=WebParser
URL=[MeasureState]
StringIndex=2
[MeterCurrTime]
MeterStyle=Text
MeasureName=MeasureCurrTime
Meter=String
X=(#WIDTH#*0.2)
Y=(#HEIGHT#/2-(#FONTSIZE#*0.8))
Prefix="Current: "
Postfix=""
The only reason update is on 1 second is so I don't spend long peoples looking at no data when the above failure happens.
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Don't update measure if no data can be read?
Are you sure about the URL? It looks weird and I can't get the skin to work, but I even can't open the URL in a browser. What is it?
A such small UpdateRate will give you a lot of headache if the skin works. Above I said why.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Don't update measure if no data can be read?
Once a second is probably ok as long as the actual URL points to a file (file://) that is accessible on the same internal network that your PC is on. Otherwise, I agree that once a second is risky indeed. It is quite likely to "hang" WebParser and require a restart of Rainmeter on a more or less regular basis.
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Don't update measure if no data can be read?
Or even better: to be blocked by the site in question, as described in the Note here: https://docs.rainmeter.net/manual-beta/measures/webparser/#UpdateRate
Notes: Some caution should be used in determining how often to connect to a site with WebParser. Excessively accessing a site can cause your computer to be seen as an "attack" and result in being blocked. The UpdateRate option defaults to 600 as a safety measure. This should not be changed unless there is some reason to connect more or less often to the site.
-
- Posts: 14
- Joined: February 19th, 2019, 2:15 pm
Re: Don't update measure if no data can be read?
The URL in the code I've given here is just a placeholder... the actual site is internal to the company, so you wouldn't be able to parse it anyway.
Each time the site is refreshed, it would normally give you this:
... and around 1 in 10 refreshes will give you this garbage:
I wonder if my repeated attepts to access it is causing the garbage... ?
Regardless, the URL itself is out of my control, but I'm just after a stable Rainmeter output for when it does give out garbage.
Each time the site is refreshed, it would normally give you this:
Code: Select all
USHelpdeskChat,9,11,7,3,0,11,0,:00,395,15:55,18,1:57,:55,66.93
Code: Select all
CodigoInvalidResultsException[origin=TelephonyRealTimeMetricsService::GetRealTimeMetrics validResults=false resultsTimedOut=false statusReason=java.lang.OutOfMemoryError: Java heap space message=java.lang.OutOfMemoryError: Java heap space]
java.lang.RuntimeException: CodigoInvalidResultsException[origin=TelephonyRealTimeMetricsService::GetRealTimeMetrics validResults=false resultsTimedOut=false statusReason=java.lang.OutOfMemoryError: Java heap space message=java.lang.OutOfMemoryError: Java heap space]
at companyname.telephony.servlet.util.RTMHandler.getRealTimeMetrics(RTMHandler.java:40)
at companyname.telephony.servlet.util.RTMHandler.getRealTimeMetrics(RTMHandler.java:31)
at companyname.telephony.servlet.util.SiteSkillReporter.getRealTimeMetrics(SiteSkillReporter.java:161)
at companyname.telephony.servlet.util.SiteSkillReporter.siteReport(SiteSkillReporter.java:403)
at companyname.telephony.servlet.SkillStatisticsServlet.doPost(SkillStatisticsServlet.java:42)
at companyname.telephony.servlet.BaseServlet.doPostAndEmitMetrics(BaseServlet.java:19)
at companyname.telephony.servlet.SkillStatisticsServlet.doGet(SkillStatisticsServlet.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
Caused by: CodigoInvalidResultsException[origin=TelephonyRealTimeMetricsService::GetRealTimeMetrics validResults=false resultsTimedOut=false statusReason=java.lang.OutOfMemoryError: Java heap space message=java.lang.OutOfMemoryError: Java heap space]
at companyname.telephony.realtimemetrics.GetRealTimeMetrics$Results.getValue(GetRealTimeMetrics.java:540)
at companyname.telephony.realtimemetrics.GetRealTimeMetrics$ResultsContext.getValue(GetRealTimeMetrics.java:493)
at companyname.telephony.realtimemetrics.GetRealTimeMetrics$Request.call(GetRealTimeMetrics.java:90)
at companyname.telephony.servlet.util.RTMHandler.getRealTimeMetrics(RTMHandler.java:37)
... 25 more
Caused by: companyname.platform.clienttoolkit.ServiceDispatcherException: java.lang.OutOfMemoryError: Java heap space
at companyname.platform.clienttoolkit.jsmart.MonitorInterceptorFirst.requestReply(MonitorInterceptorFirst.java:79)
at companyname.platform.clienttoolkit.InterceptorInvoker.requestReply(InterceptorInvoker.java:49)
at companyname.platform.clienttoolkit.bsf.BSFChainedServiceDispatcher.requestReply(BSFChainedServiceDispatcher.java:154)
at companyname.platform.clienttoolkit.ServiceDispatcher.requestReply(ServiceDispatcher.java:91)
at companyname.platform.clienttoolkit.bsf.BSFServiceDispatcher.requestReply_(BSFServiceDispatcher.java:284)
at companyname.platform.clienttoolkit.bsf.BSFServiceDispatcher.requestReply(BSFServiceDispatcher.java:264)
at companyname.telephony.realtimemetrics.GetRealTimeMetrics$Batch.callSync(GetRealTimeMetrics.java:298)
... 27 more
Caused by: java.lang.OutOfMemoryError: Java heap space
Regardless, the URL itself is out of my control, but I'm just after a stable Rainmeter output for when it does give out garbage.
-
- Posts: 14
- Joined: February 19th, 2019, 2:15 pm
Re: Don't update measure if no data can be read?
Oh and no worries about the site blocking me - it's an internal site managed by our company... just out of reach of me.
-
- Rainmeter Sage
- Posts: 5391
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Don't update measure if no data can be read?
According to your posted results:
Caused by: java.lang.OutOfMemoryError: Java heap space
So it appears the issue is with your Java language. I would suggest trying a slightly larger updaterate on the webparser (3~5 seconds or longer) and see if that corrects the garbage.
I cannot think of anything that can be done in Rainmeter to the Webparser that would help.
The error needs to be corrected in the Java area or by not over whelming the amount of memory available to Java; thus the suggestion to increase the wait time.
Good luck
Caused by: java.lang.OutOfMemoryError: Java heap space
So it appears the issue is with your Java language. I would suggest trying a slightly larger updaterate on the webparser (3~5 seconds or longer) and see if that corrects the garbage.
I cannot think of anything that can be done in Rainmeter to the Webparser that would help.
The error needs to be corrected in the Java area or by not over whelming the amount of memory available to Java; thus the suggestion to increase the wait time.
Good luck
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::