Closed Bug 582499 Opened 15 years ago Closed 15 years ago

Django-mozilla-product-details should detect new JSON files without being force-reloaded

Categories

(mozilla.org Graveyard :: Webdev, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: wenzel, Unassigned)

References

Details

Over in bug 582438, new versions weren't detected, I assume because we load the JSON files into module-global variables. These stay loaded as long as the Python process is alive. Ergo, the JSON files change and we don't notice. Should probably fix this somehow. CCing jbalogh: Do you have a suggestion for this? We could implement __getattr__ (hope I remember this right) instead of writing the parsed JSON files directly into locals() and then re-read the JSON files with a probability < 1 on read? That's fuzzy, so maybe you have another idea that does not involve reading the files off disk every time the data is accessed ;) Thanks!
Our processes die often enough that we were planning on ignoring this problem on AMO. Do yours live a long time?
Apparently! IIRC, WSGI restarts processes on occasion (i.e., every n requests). It's possible that I just didn't get enough requests on Input for this to happen. So either we change that setting, or fix it in code.
You could measure if it's been N minutes since your last check and start a thread to try an update. That would happen in every process you're running (we have 16 per webhead). Sounds complicated.
Depends on: 582908
What's next here? Been a while since anybody talked about it.
I still vote for sticking the data in memcached with a ~3hr expiration. It's clean and avoids the thread problem.
Yea, James and I worked this out while in Portland -- I agree that we can just stick it into Django's caching interface for a few hours and have it reload off disk after that expires. Should be a transparent change for the apps that use it and therefore easy to implement and deploy.
Is there anything left for this?
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
Nah, we're fine. We'll tweak that library as we go when we make a generic application template.
Product: mozilla.org → mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.