weather-gov / weather.gov

weather.gov 2.0
Other
329 stars 9 forks source link

Point location pages should not be cached by Drupal #2070

Open greg-does-weather opened 2 days ago

greg-does-weather commented 2 days ago

Description

Previously we defeated caching by disabling it on all of our dynamic Drupal blocks, but since we're not using blocks anymore, we need to find a way to disable caching by route or page. Otherwise a location, once loaded, may not refresh. For example, this point page shows an error that suggests the interop layer failed to return, but in reality, the interop layer is returning just fine: https://api-weathergov-beta.app.cloud.gov/point/44.998/-93.156

Acceptance criteria

colinmurphy01 commented 2 days ago

What's the frequency of this?

greg-does-weather commented 2 days ago

I don't know about frequency, but the Drupal page caching is quite long-lived. I haven't been able to get my own forecast since the last deployment, even though the interop layer has been fine. I'm about to clear beta's cache so it should resolve for now, but if an error on a particular page means that page is unusable until we manually clear the cache, that's a problem!

eric-gade commented 23 hours ago

So after messing with this for some time, I'm not able to find another reproducible example, and I can't replicate this locally. Everything I'm seeing indicates that the cache should be invalidated in Drupal. We can optionally pass the no_cache: 'TRUE' flag to all routes upon which we want to completely eliminate the possibility to drupal caching, but I've done that locally and I haven't noticed any difference.

Perhaps the first move here should be to add that option to all routes we want it on, and see how the next deploy goes...

greg-does-weather commented 23 hours ago

Yeah, I've only seen it in cases where the interop layer returned an error and then later returned valid data. The error state was cached for that specific route somehow long after the actual error was resolved. It doesn't make sense, especially since I could see the actual calls still going tot he interop layer and returning good data. Like, why even bother with caching if you're still going to re-fetch the data anyway? 😛