From 7540b7eb318b552a4324adccf5d64d39fad2ee12 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 6 Feb 2020 17:59:20 -0800 Subject: [3.0.x] Fixed #31253 -- Fixed data loss possibility when using caching from async code. Case missed in a415ce70bef6d91036b00dd2c8544aed7aeeaaed. Backport of e3f6e18513224c8ad081e5a19da641f49b0b43da from master --- django/core/cache/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'django') diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py index a6b956fdf2..735b83e94f 100644 --- a/django/core/cache/__init__.py +++ b/django/core/cache/__init__.py @@ -12,7 +12,7 @@ object. See docs/topics/cache.txt for information on the public API. """ -from threading import local +from asgiref.local import Local from django.conf import settings from django.core import signals @@ -61,7 +61,7 @@ class CacheHandler: Ensure only one instance of each alias exists per thread. """ def __init__(self): - self._caches = local() + self._caches = Local() def __getitem__(self, alias): try: -- cgit v1.3