#28342: Make PyLibMCCache backend catch exceptions when memcached server is down
-------------------------------------+-------------------------------------
     Reporter:  Julian Andrews       |                    Owner:  Julian
         Type:                       |  Andrews
  Cleanup/optimization               |                   Status:  assigned
    Component:  Core (Cache system)  |                  Version:  1.11
     Severity:  Normal               |               Resolution:
     Keywords:  memcached cache      |             Triage Stage:  Accepted
  pylibmc                            |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Julian Andrews):

 I've written up a patch here: https://github.com/django/django/pull/8681.
 I looked at the `django-pylibmc` code, and it was very similar to what I
 was already doing, but there are a few differences.

 First, `django-pylibmc` seems to be returning `False` to indicate failure
 for a bunch of methods (and `None` to indicate success). Given that that
 differs from the `MemcachedCache` behavior, and that the `False` vs.
 `None` distinction is sort of confusing, I decided to stick with the
 default behavior. I actually like the idea of a return value that
 indicates if cache fetch was successful, but in that case, the relevant
 methods should probably always return `True` or `False`, and that behavior
 should be consistent across backends. I decided not to do that as part of
 this PR.

 Second, `django-pylibmc` includes logging of errors. I actually *really*
 like that, but again, it's not consistent with the other backend behavior,
 so I didn't include that. I could add logging though I'm not really that
 familiar with the django logging conventions, so some pointers on that
 would be helpful!

 Third, `django-pylibmc` was never catching `ConnectionError`s. As far as I
 can tell, when the memcached server goes down, the first error gets a
 `ConnectionError` and then later ones throw `ServerDown` so I'm pretty
 sure we need to catch both.

--
Ticket URL: <https://code.djangoproject.com/ticket/28342#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.a903d71c4178998e4e3457304f317f4d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to