فهرست منبع

Django fixup should close all cache backends (#4187)

Raphaël Riel 7 سال پیش
والد
کامیت
f3f67917f3
2فایلهای تغییر یافته به همراه2 افزوده شده و 4 حذف شده
  1. 1 1
      celery/fixups/django.py
  2. 1 3
      t/unit/fixups/test_django.py

+ 1 - 1
celery/fixups/django.py

@@ -193,7 +193,7 @@ class DjangoWorkerFixup(object):
 
     def close_cache(self):
         try:
-            self._cache.cache.close()
+            self._cache.close_caches()
         except (TypeError, AttributeError):
             pass
 

+ 1 - 3
t/unit/fixups/test_django.py

@@ -227,9 +227,7 @@ class test_DjangoWorkerFixup(FixupCase):
     def test_close_cache(self):
         with self.fixup_context(self.app) as (f, _, _):
             f.close_cache()
-            f._cache.cache.close.assert_called_with()
-            f._cache.cache.close.side_effect = TypeError()
-            f.close_cache()
+            f._cache.close_caches.assert_called_with()
 
     def test_on_worker_ready(self):
         with self.fixup_context(self.app) as (f, _, _):