#36047: `BaseConnectionHandler.close_all()` doesn't work with async clients
--------------------------+-----------------------------------------------
     Reporter:  amirreza  |                     Type:  Bug
       Status:  new       |                Component:  Core (Cache system)
      Version:  5.1       |                 Severity:  Normal
     Keywords:            |             Triage Stage:  Unreviewed
    Has patch:  0         |      Needs documentation:  0
  Needs tests:  0         |  Patch needs improvement:  0
Easy pickings:  0         |                    UI/UX:  0
--------------------------+-----------------------------------------------
 hi
 in django.core.cache there is this code:

 {{{
 caches = CacheHandler()


 def close_caches(**kwargs):
     # Some caches need to do a cleanup at the end of a request cycle. If
 not
     # implemented in a particular backend cache.close() is a no-op.
     caches.close_all()
 }}}

 where `CacheHandler` is a subclass of `BaseConnectionHandler`
 `close_all()` looks like this:

 {{{
     def close_all(self):
         for conn in self.all(initialized_only=True):
             conn.close()
 }}}


 but when a async client is at work, `.close()` doesn't work, it needs to
 be `await conn.aclose()`

 note that in my case (django-valkey) there is no way for async clients to
 implement a sync method for `close`

 p.s: i know django doesn't fully support async cache clients, i open this
 issue so the problem doesn't get lost
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36047>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701941e642005-cea06d20-ba1f-45ac-a33a-6ac1cd0fde7d-000000%40eu-central-1.amazonses.com.

Reply via email to