Opened 6 days ago
Last modified 5 days ago
#36047 closed Bug
`BaseConnectionHandler.close_all()` doesn't work with async clients — at Initial Version
Reported by: | amirreza | Owned by: | |
---|---|---|---|
Component: | Core (Cache system) | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Note:
See TracTickets
for help on using tickets.