diff --git a/kolibri/core/tasks/utils.py b/kolibri/core/tasks/utils.py index 256933c937a..3125a70f5b4 100644 --- a/kolibri/core/tasks/utils.py +++ b/kolibri/core/tasks/utils.py @@ -5,7 +5,6 @@ from kolibri.core.tasks import compat from kolibri.core.utils.cache import DiskCacheRLock -from kolibri.core.utils.cache import process_cache # An object on which to store data about the current job @@ -121,4 +120,4 @@ def shutdown(self): self.stop() -db_task_write_lock = DiskCacheRLock(process_cache, "db_task_write_lock") +db_task_write_lock = DiskCacheRLock("db_task_write_lock") diff --git a/kolibri/core/utils/cache.py b/kolibri/core/utils/cache.py index 2d31c060667..88171d67e44 100644 --- a/kolibri/core/utils/cache.py +++ b/kolibri/core/utils/cache.py @@ -28,8 +28,8 @@ class DiskCacheRLock(object): https://github.com/grantjenks/python-diskcache/blob/2d1f43ea2be4c82a430d245de6260c3e18059ba1/diskcache/recipes.py """ - def __init__(self, cache, key, expire=None): - self._cache = cache + def __init__(self, key, expire=None): + self._cache = process_cache self._key = key self._expire = expire @@ -82,9 +82,7 @@ def __init__(self, cache, namespace, **params): params.update(KEY_PREFIX=namespace) super(NamespacedCacheProxy, self).__init__(params) self.cache = cache - self._lock = DiskCacheRLock( - process_cache, "namespaced_cache_{}".format(namespace) - ) + self._lock = DiskCacheRLock("namespaced_cache_{}".format(namespace)) def _get_keys(self): """