If you ask a question and then go back to the main screen of the app, the list of questions doesn't include the newly asked question.
I'm pretty sure about a few things a) This is the same thing that the question moderation addon that phillip wrote was running into. b) This is django-cache-machine caching things. c) The question listing is affected similarly when the queries are identical. The fact that phillip was seeing questions on the site before in the API can be explained as well. DCM uses the SQL generated by a query as a cache key. That effectively means that each kind of ORM query is cached separately depending on the options used. The cache for phillip's addon would be mainly used by that addon, and nothing else, and so would be on it's own timer. The website would likely use a distinct set of filters, and so would have a different cache timer, that could expire at times not in sync with the addon's timer, so it would seem to get results sooner (or later, but no one was watching for that). I don't think this is ok. We should try and flush the caches when a new object is created. DCM already flushes caches when objects are edited, but it can't do anything with objects are added, because it doesn't have a way to determine what cached items would correlate to the new object. Options: 1) Don't use the cache at all in the API. Just use Questions.uncached all the time. This sounds slow. 2) Patch DCM so it understands object creation. This sounds hard. It would also require upgrading DCM. 3) Manually flush the cache when an object is created. We would have to be clever enough to figure out all the cache keys to flush, but I think this is the right way forward. 4) Give the API a way to cachebust. 5) Something else.
3 would be a good compromise. If we see that it's slowing things too much for the website, we could move to 4.
Assignee: nobody → mcooper
Priority: -- → P2
Whiteboard: u=user c=BuddyUp p= s=2014.21
Target Milestone: --- → 2014Q4
Any updates on this one?
I haven't started this yet.
We decided to disable caching for the API. If this proves to be a mistake in the future we can revisit this. We also discussed getting rid of django-cache-machine since it is largely unmaintained, and magic caches are hard to work with. PR: https://github.com/mozilla/kitsune/pull/2225 Landed in: https://github.com/mozilla/kitsune/commit/16de5f4efd58e7900af3a6105b095c23ea7626ba I can't deploy this to stage because forum redesign bugs are waiting for needsverify there.
Status: NEW → ASSIGNED
Landed: https://github.com/mozilla/kitsune/commit/16de5f4efd58e7900af3a6105b095c23ea7626ba Pushed to prod by me, earlier today.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.