# HG changeset patch # User Marcin Kuzminski # Date 2019-02-08 15:08:03 # Node ID 24601e964c0f2f6aee5452c5c58dd60d370ddedb # Parent e151f23172e5e0d6987c3de5119072c4a91135db redis: add logging about lock acquire, this should help in case of locked row debugging diff --git a/rhodecode/lib/rc_cache/backends.py b/rhodecode/lib/rc_cache/backends.py --- a/rhodecode/lib/rc_cache/backends.py +++ b/rhodecode/lib/rc_cache/backends.py @@ -203,3 +203,12 @@ class RedisPickleBackend(Serializer, red for key, value in mapping.items(): pipe.setex(key, self.redis_expiration_time, value) pipe.execute() + + def get_mutex(self, key): + u = redis_backend.u + if self.distributed_lock: + lock_key = u('_lock_{0}').format(key) + log.debug('Trying to acquire Redis lock for key %s', lock_key) + return self.client.lock(lock_key, self.lock_timeout, self.lock_sleep) + else: + return None