Prechádzať zdrojové kódy

Added check to make sure to only close cache connection if its not locmem.
Also fixed clean_process

Vitaly Babiy 16 rokov pred
rodič
commit
01f82ba425
1 zmenil súbory, kde vykonal 4 pridanie a 3 odobranie
  1. 4 3
      celery/worker.py

+ 4 - 3
celery/worker.py

@@ -73,11 +73,12 @@ def jail(task_id, func, args, kwargs):
     connection.close()
     connection.close()
 
 
     # Reset cache connection
     # Reset cache connection
-    from django.core.cache import cache
-    cache.close()
+    from django.core.cache import cache, backends
+    if not isinstance(cache,backends.locmem.CacheClass):
+        cache.close()
 
 
     # Backend process cleanup
     # Backend process cleanup
-    default_backend.process_cleanup()
+    default_backend.cleanup_process()
 
 
     # Convert any unicode keys in the keyword arguments to ascii.
     # Convert any unicode keys in the keyword arguments to ascii.
     kwargs = dict([(k.encode("utf-8"), v)
     kwargs = dict([(k.encode("utf-8"), v)