Show More
@@ -391,6 +391,8 b' rc_cache.cache_perms.expiration_time = 3' | |||
|
391 | 391 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends |
|
392 | 392 | #rc_cache.cache_perms.arguments.distributed_lock = true |
|
393 | 393 | |
|
394 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen | |
|
395 | #rc_cache.cache_perms.arguments.lock_auto_renewal = true | |
|
394 | 396 | |
|
395 | 397 | ; *************************************************** |
|
396 | 398 | ; `cache_repo` cache for file tree, Readme, RSS FEEDS |
@@ -414,6 +416,8 b' rc_cache.cache_repo.expiration_time = 25' | |||
|
414 | 416 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends |
|
415 | 417 | #rc_cache.cache_repo.arguments.distributed_lock = true |
|
416 | 418 | |
|
419 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen | |
|
420 | #rc_cache.cache_repo.arguments.lock_auto_renewal = true | |
|
417 | 421 | |
|
418 | 422 | ; ############## |
|
419 | 423 | ; BEAKER SESSION |
@@ -224,6 +224,16 b' class FileNamespaceBackend(PickleSeriali' | |||
|
224 | 224 | |
|
225 | 225 | |
|
226 | 226 | class BaseRedisBackend(redis_backend.RedisBackend): |
|
227 | key_prefix = '' | |
|
228 | ||
|
229 | def __init__(self, arguments): | |
|
230 | super(BaseRedisBackend, self).__init__(arguments) | |
|
231 | self._lock_timeout = self.lock_timeout | |
|
232 | self._lock_auto_renewal = arguments.pop("lock_auto_renewal", False) | |
|
233 | ||
|
234 | if self._lock_auto_renewal and not self._lock_timeout: | |
|
235 | # set default timeout for auto_renewal | |
|
236 | self._lock_timeout = 60 | |
|
227 | 237 | |
|
228 | 238 | def _create_client(self): |
|
229 | 239 | args = {} |
@@ -289,14 +299,8 b' class BaseRedisBackend(redis_backend.Red' | |||
|
289 | 299 | if self.distributed_lock: |
|
290 | 300 | lock_key = redis_backend.u('_lock_{0}').format(key) |
|
291 | 301 | log.debug('Trying to acquire Redis lock for key %s', lock_key) |
|
292 | ||
|
293 | auto_renewal = True | |
|
294 | lock_timeout = self.lock_timeout | |
|
295 | if auto_renewal and not self.lock_timeout: | |
|
296 | # set default timeout for auto_renewal | |
|
297 | lock_timeout = 10 | |
|
298 | return get_mutex_lock(self.client, lock_key, lock_timeout, | |
|
299 | auto_renewal=auto_renewal) | |
|
302 | return get_mutex_lock(self.client, lock_key, self._lock_timeout, | |
|
303 | auto_renewal=self._lock_auto_renewal) | |
|
300 | 304 | else: |
|
301 | 305 | return None |
|
302 | 306 |
General Comments 0
You need to be logged in to leave comments.
Login now