6.0.0-beta1
7/5/25

[#10851] Reduce cost of geolookup in Weatherunderground driver
Summary Reduce cost of geolookup in Weatherunderground driver
Queue Horde Framework Packages
Queue Version Git master
Type Enhancement
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester arjen+horde (at) de-korte (dot) org
Created 12/10/2011 (4956 days ago)
Due
Updated 12/10/2011 (4956 days ago)
Assigned
Resolved 12/10/2011 (4956 days ago)
Milestone
Patch Yes

History
12/10/2011 09:06:19 PM Michael Rubinsky Comment #3
Assigned to Michael Rubinsky
State ⇒ Resolved
Reply to this comment
Makes sense to me.

Committed, thanks!
12/10/2011 09:05:45 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git for this ticket:

Use longer cachetime for non-changing values Request: 10851
Signed-off-by: Michael J Rubinsky <mrubinsk@horde.org>

  1 files changed, 3 insertions(+), 3 deletions(-)
http://git.horde.org/horde-git/-/commit/7bdf164d596c1bcd3c8c8bed94943bf5b804355c
12/10/2011 08:44:26 PM arjen+horde (at) de-korte (dot) org Comment #1
Priority ⇒ 1. Low
New Attachment: Service_Weather.diff Download
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ Reduce cost of geolookup in Weatherunderground driver
Type ⇒ Enhancement
State ⇒ New
Reply to this comment
While fiddling around with the cache time of Service_Weather, I 
noticed that the number of calls to the Weatherunderground provider 
where roughly twice the number I expected based on the cache time. 
After logging the requests, I found before the forecast/conditions are 
updated, a geolookup is performed for the location.

No suprise to find that the returned data is static (probably will 
never change) unlike the forecast/conditions data that changes for 
almost each request. Therefor it might pay to do the geolookup only 
once per session and after that use the looked up station until a 
different location is chosen.

On the otherhand, in organizations where many people are tracking the 
same weather station, it might be more beneficial to just treat the 
cache times for the geolookup and forecast/condition lookups 
differently, setting the first very long. The attached patch will do 
the last. It hardcodes the cache lifetime for the geolookup to 86400 
seconds (one day) and uses the configured 
$conf['weather']['params']['lifetime'] value only for the information 
that is likely to change (and where a configurable lifetime is much 
more useful, to balance the number of requests and the fresh/staleness 
of weather data).

I'm not quite sure if this value should be configurable. The looked up 
data is small (so unlikely will use up lots of cache space) and the 
most one could gain by upping this value to an even higher value is 
one lookup per day. Personally, I don't feel this is worth the effort.

Saved Queries