I installed this on my Drupal 5.x site and think it is a useful addition.

I am reporting on weather at Dubai International Airport but as of now (5:30PM ET 2/18) it is showing weather for 2/17 18:00???

I went to a website and queried the relevant ICAO station: OMDB and got the stream below as the current report.

OMDB 182200Z 34003KT 310V020 CAVOK 19/14 Q1012 NOSIG

Is Drupal keeping the info somewhere and not refreshing it?

Thanks,
Paul

CommentFileSizeAuthor
#18 zmod.tgz573 bytessteinmb

Comments

paulcoghlan’s picture

I have done a little further testing. Each time I change the location to a location not previously used the module works properly and displays the current time/weather. However, this information does not change at any point. It appears only to be a snapshot and is not updated.

if I revert to a location previously used the information displayed is that from the point I first used that location. It does not display new information.

very odd!

markymarknz1’s picture

Yeah I have the same issue.
When I specify a new location it gets the data fine, but then never updates again.
I am guessing that it's some issue with caching however I have tested all the different caching options (turning off etc) and not change.
Any advise about this would be great :)

paulcoghlan’s picture

Actually I have done further testing and it appears to be a non-US issue.

METAR data is structured differently for US and non-US locations. I suspect the parser for non-US locations has a problem.

toddy’s picture

Assigned: Unassigned » toddy
Category: support » bug

Hi,

thanks for this bug report. I can confirm that the caching is the culprit. However, this only affects anonymous (not logged in) users. I don't see this behaviour when I'm logged in. Can you confirm that you don't see this bug when you're logged in into your site?

Regards,
Tobias

markymarknz1’s picture

Yeah I can confirm that it updates when someone has logged in.
Is it only meant to update once a day?
Has someone posted a bug report?

toddy’s picture

Title: no/slow weather refresh » Caching disables refreshing of weather data for anonymous users

No, the weather data is refreshed hourly. However, this will only work if the actual METAR weather data of the station has changed. Some stations don't update that frequently.

markymarknz1’s picture

Thanks Toddy I appreciate your work.
If you want any help let me know. I'm not a pro but tinker around a bit :)

urwas’s picture

Hi,

i was trying to determine why the weather data are not updated and found that there was no update of the METAR data for my location since 2006/12/22 15:20 UTC (EDBM)... so its not a caching problem of the weather-module!

Are there any other weather services we could use for getting actual data?

Greetings!

toddy’s picture

Hi,

I can confirm that the data for EDBM is quite old. However, the caching problem remains for anonymous users. Apart from that, I don't know of free sources which provide current weather data.

Regards,
Tobias

alanburke’s picture

I am experiencing a similar issue, but also for logged in users.

Even with caching disabled, the weather block doesn't refresh itself unless the ICAO changes.

Once changed, and cron is run, the block updates.
Switch back to old ICAO code, run cron, Fresh details for new ICAO appear.

Also non-US, if that makes a difference.

Regards
Alan

steinmb’s picture

Hi Tobias

Did you solve this problem, and did any of this make it into the code? I mean the latest 4.7.x-3.5 and this problem was still around in may or is it only fixed in the 5.x release?

--
Stein

toddy’s picture

Version: 5.x-1.1 » 6.x-5.x-dev

This problem is still not solved. Anyone with good ideas or patches speak up, please.

Regards,
Tobias

steinmb’s picture

I think we need some what really know the caching system to Drupal. I think that is the fastest way to do it, insted of hack around in the code for weeks and weeks. Should be more modules that have had this problem, right. It is modules that are tagged not to be used with Aggressive caching (Sorry cant give any names of the top of my mind).

steinmb’s picture

I looked quickly through your code but don't see you flushing the cache.

cache_clear_all('my_module', 'cache', TRUE); 

I'm not a PHP-guru (sorry) but it could be that easy. Alot if hints on http://www.lullabot.com/articles/a_beginners_guide_to_caching_data
And a more of a trick:
http://www.seo-expert-blog.com/blog/clearing-drupals-page-cache-after-ad...

--
Stein Magne

toddy’s picture

Unfortunately, that's not the solution. The function you mentioned is only useful for clearing the module's own cache, if it uses one. The Weather module does not use caching, so that function is without effect. Thanks for your research, though.

Regards,
Tobias

steinmb’s picture

I continue my quest on asking silly questions:

Even if Weather module does not have it own cache, does Drupal has a cache. When it is turned on is all page-output (frontpage included) cahced in table cache_page and served to non logged-in-users, right?

And if none modules in Drupal tell the cache that this page is updated (set the page expired), Drupal sees no reason to update the page cache. So if the Weather block is in the frontpage, you must tell Drupal that the frontpage has expired.

I still think http://www.seo-expert-blog.com/blog/more-on-clearing-drupals-page-cache is a good ide, maybye as a temp. workaround.

I just want to help you fix this problem. I can't have caching off just get weather info updated. As it now is, the cached frontpage is updated everytime I post something new on the site, I just have to keep posting then :)

--
Stein Magne

toddy’s picture

So if the Weather block is in the frontpage, you must tell Drupal that the frontpage has expired.

Right, that would probably work. However, I would need to find out on which (cached) pages the block is shown. I don't know if there is an easy way to get this information.

steinmb’s picture

StatusFileSize
new573 bytes

This is a workaround that works for me:
I found this code in some old postings and created a module for Druapl 5 of it. I uses a hook from every time cron.php is run by your system and flushes the drupal cache. This forces Drupal to rebuild the content of its cache. I run this every 30 min on mine site. Just enable the module and remember to test your site afterward.

Back to the orginal problem Tobias, to make weather module work with Drupal cache it have to create it own "space" in the drupal page_cache and every time new weather data is collected the module run

cache_clear_all('weather_module', 'cache', TRUE);

This is much finer grain control then cache_clear_all anyway the load from clear_all is not larger then when a logged in user i logging in so I think we can use it as a temp. fix. Like I prev. wrote I'm not really a PHP programmer so can not provide you with any patches, sorry about that...

--
Stein Magne Bjorklund

toddy’s picture

Status: Active » Fixed

Thanks for your work. I think I've found a solution to this problem, it's committed in CVS and will be available in the next version.

Anonymous’s picture

Status: Fixed » Closed (fixed)
xamount’s picture

Hmmm, I have Weather 5.x-6.2 installed and I am still experiencing this problem with caching. Its works for logged in users but not for anonymous users. Any help is appreciated.

The weather block is on the home page and coincidentally, nodes have not been published to the front page in over a week.....although that will change pretty soon (like every day).

jrefano’s picture

weather for anon users was working fine till i upgraded to 5.5 from 5.4, now i am having this issue on 6.x-5.5, even with the "clear cache once per hour option turned on" -- anon users arent getting current weather. also, there has to be a better way to do this than to clear the entire drupal cache just to refresh the weather... right? that's borderline insanity!