From 7034f165ac0e7c292e81e59e1748f45b7860edfe Mon Sep 17 00:00:00 2001 From: M1ha Date: Fri, 25 Jan 2019 13:47:26 +0500 Subject: [PATCH] Changed RedisLock blocking alogrythm, so it doesn't wait, if sync takes a little more than sync period --- src/django_clickhouse/storages.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/django_clickhouse/storages.py b/src/django_clickhouse/storages.py index 1636d7a..798c37a 100644 --- a/src/django_clickhouse/storages.py +++ b/src/django_clickhouse/storages.py @@ -197,8 +197,9 @@ class RedisStorage(with_metaclass(SingletonMeta, Storage)): from .redis import RedisLock lock_key = self.REDIS_KEY_LOCK.format(import_key=import_key) lock_timeout = kwargs.get('lock_timeout', config.SYNC_DELAY * 10) - self._locks[import_key] = RedisLock(self._redis, lock_key, timeout=lock_timeout, blocking_timeout=0.1, - thread_local=False) + blocking_timeout = kwargs.get('blocking_timeout', config.SYNC_DELAY) + self._locks[import_key] = RedisLock(self._redis, lock_key, timeout=lock_timeout, + blocking_timeout=blocking_timeout, thread_local=False) return self._locks[import_key]