RedisDjango

Synchronous cache operations block asyncio event loop in session replay

warning
performanceUpdated Mar 17, 2026(via Exa)
How to detect:

When _get_cached_blocks calls cache.get() and _cache_blocks calls cache.set() synchronously from within list_blocks_async, they block the event loop during cache I/O operations such as Redis round-trips. This degrades performance and concurrency in async code paths.

Recommended action:

Upgrade to Django 4.1+ and replace synchronous cache.get() with await cache.aget() and cache.set() with await cache.aset() in async code paths. Separate async cache helpers from sync helpers rather than sharing them.