Opened 3 days ago
Closed 33 hours ago
#36047 closed Bug (invalid)
`BaseConnectionHandler.close_all()` doesn't work with async clients
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 (last modified by )
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 an 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
Change History (3)
comment:1 by , 3 days ago
Description: | modified (diff) |
---|
comment:2 by , 39 hours ago
comment:3 by , 33 hours ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Agreed, as we don't have support for async clients, this isn't a valid bug. I will link this to #33573 as I believe this was raised to be informational
Is this ticket actionable before Django supports async cache clients?