Conversation
@escattone - I've done a little more research, and I think I sent you down a dead end. First, we're on django-cacheback 1.0, so make sure you are reading that code, not the latest. I'd like to update that and all our dependencies, but that's another PR. First place in the tour is In both cases, cache_set is called. This stores the tuple So, I have other guesses, but I don't want to send you down any other dead ends, so doing more research first. |
OK, further research:
So, I don't think there is a error causing needless cacheback jobs. I'd support increasing the cache limit to something like 29 hours, so that the cache lasts more than a day and maybe avoids being triggered by a once-a-day crawler but instead gets distributed by organic traffic. Plus, 29 is prime. |
@jwhitlock: Oh, of course, you're absolutely right, thanks for looking into that. It's frustrating how at times something can be "staring you in the face" and I still don't see it. I'll close this PR and submit a new one just for bug 1365960. |
@jwhitlock: Just read your latest comment. Ah yes, the cache timeout is short, especially given that with #4209 we should be invalidating the cache properly. So how does this sound, I'll modify this PR as follows:
|
The only thing I could think of that could go wrong is if you move a page into a zone, it could take a while for the zone to be applied. But, that could be fixed by invalidating on the Document save signal. |
@jwhitlock We are already invalidating the nearest-zone cache on document save so I think we're covered for that case? |
* this should ease the spike in celery tasks (bug 1366044)
OK, I refactored the two commits:
|
Ready for your review again @jwhitlock! |
Codecov Report
@@ Coverage Diff @@
## master #4241 +/- ##
=======================================
Coverage 86.56% 86.56%
=======================================
Files 150 150
Lines 9065 9065
Branches 1198 1198
=======================================
Hits 7847 7847
Misses 990 990
Partials 228 228
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 looks good, ship it! ⛵️
This PR addresses two problems introduced in #4209 (addressing bug 944186):
I wanted to prove (via a test case) that using
None
for the "empty" value for theDocumentNearestZoneJob
class effectively bypasses the cache, along the lines of something like this:which I thought should fail (on the mock assertion) when using
None
for empty and succeed when usingFalse
, but for the life of me I couldn't get it to fail when usingNone
. A long, detailed look at thedjango-cacheback
code has me convinced that it should fail, but it doesn't in my tests.