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)
mozilla.org Graveyard
Webdev
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!
Comment 1•15 years ago
|
||
Our processes die often enough that we were planning on ignoring this problem on AMO. Do yours live a long time?
| Reporter | ||
Comment 2•15 years ago
|
||
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.
Comment 3•15 years ago
|
||
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.
Comment 4•15 years ago
|
||
What's next here? Been a while since anybody talked about it.
Comment 5•15 years ago
|
||
I still vote for sticking the data in memcached with a ~3hr expiration. It's clean and avoids the thread problem.
| Reporter | ||
Comment 6•15 years ago
|
||
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.
Comment 7•15 years ago
|
||
Is there anything left for this?
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
| Reporter | ||
Comment 8•15 years ago
|
||
Nah, we're fine. We'll tweak that library as we go when we make a generic application template.
Updated•7 years ago
|
Product: mozilla.org → mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•