Explorar o código

Can't exact match for "memcached". Search for it as a substring instead.
At Opera we use a custom cache backend that uses libmemcached instead of
libmemcache (cmemcache).
Should find a better solution for this, but for now "memcached" should
probably be unique enough of a string to not make problems.

Ask Solem %!s(int64=16) %!d(string=hai) anos
pai
achega
de36431b07
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      celery/worker.py

+ 6 - 2
celery/worker.py

@@ -72,9 +72,13 @@ def jail(task_id, func, args, kwargs):
     from django.db import connection
     connection.close()
 
-    # Reset cache connection only if using memcached
+    # Reset cache connection only if using memcached/libmemcached
     from django.core import cache
-    if cache.parse_backend_uri(cache.settings.CACHE_BACKEND)[0] == 'memcached':
+    # XXX At Opera we use a custom memcached backend that uses libmemcached
+    # instead of libmemcache (cmemcache). Should find a better solution for
+    # this, but for now "memcached" should probably be unique enough of a
+    # string to not make problems.
+    if "memcached" in cache.parse_backend_uri(settings.CACHE_BACKEND)[0]:
         cache.cache.close()
 
     # Backend process cleanup