Show More
@@ -1,6 +1,5 b'' | |||||
1 | [bumpversion] |
|
1 | [bumpversion] | |
2 |
current_version = 4.2 |
|
2 | current_version = 4.26.0 | |
3 | message = release: Bump version {current_version} to {new_version} |
|
3 | message = release: Bump version {current_version} to {new_version} | |
4 |
|
4 | |||
5 | [bumpversion:file:vcsserver/VERSION] |
|
5 | [bumpversion:file:vcsserver/VERSION] | |
6 |
|
@@ -5,12 +5,10 b' done = false' | |||||
5 | done = true |
|
5 | done = true | |
6 |
|
6 | |||
7 | [task:fixes_on_stable] |
|
7 | [task:fixes_on_stable] | |
8 | done = true |
|
|||
9 |
|
8 | |||
10 | [task:pip2nix_generated] |
|
9 | [task:pip2nix_generated] | |
11 | done = true |
|
|||
12 |
|
10 | |||
13 | [release] |
|
11 | [release] | |
14 |
state = |
|
12 | state = in_progress | |
15 |
version = 4.2 |
|
13 | version = 4.26.0 | |
16 |
|
14 |
@@ -191,6 +191,9 b' rc_cache.repo_object.expiration_time = 2' | |||||
191 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends |
|
191 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends | |
192 | #rc_cache.repo_object.arguments.distributed_lock = true |
|
192 | #rc_cache.repo_object.arguments.distributed_lock = true | |
193 |
|
193 | |||
|
194 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen | |||
|
195 | #rc_cache.repo_object.arguments.lock_auto_renewal = true | |||
|
196 | ||||
194 | ; Statsd client config |
|
197 | ; Statsd client config | |
195 | #statsd.enabled = false |
|
198 | #statsd.enabled = false | |
196 | #statsd.statsd_host = 0.0.0.0 |
|
199 | #statsd.statsd_host = 0.0.0.0 |
@@ -154,6 +154,9 b' rc_cache.repo_object.expiration_time = 2' | |||||
154 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends |
|
154 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends | |
155 | #rc_cache.repo_object.arguments.distributed_lock = true |
|
155 | #rc_cache.repo_object.arguments.distributed_lock = true | |
156 |
|
156 | |||
|
157 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen | |||
|
158 | #rc_cache.repo_object.arguments.lock_auto_renewal = true | |||
|
159 | ||||
157 | ; Statsd client config |
|
160 | ; Statsd client config | |
158 | #statsd.enabled = false |
|
161 | #statsd.enabled = false | |
159 | #statsd.statsd_host = 0.0.0.0 |
|
162 | #statsd.statsd_host = 0.0.0.0 |
@@ -784,7 +784,7 b' self: super: {' | |||||
784 | }; |
|
784 | }; | |
785 | }; |
|
785 | }; | |
786 | "rhodecode-vcsserver" = super.buildPythonPackage { |
|
786 | "rhodecode-vcsserver" = super.buildPythonPackage { | |
787 |
name = "rhodecode-vcsserver-4.2 |
|
787 | name = "rhodecode-vcsserver-4.26.0"; | |
788 | buildInputs = [ |
|
788 | buildInputs = [ | |
789 | self."pytest" |
|
789 | self."pytest" | |
790 | self."py" |
|
790 | self."py" |
@@ -29,6 +29,8 b' from dogpile.cache.backends import redis' | |||||
29 | from dogpile.cache.backends.file import NO_VALUE, compat, FileLock |
|
29 | from dogpile.cache.backends.file import NO_VALUE, compat, FileLock | |
30 | from dogpile.cache.util import memoized_property |
|
30 | from dogpile.cache.util import memoized_property | |
31 |
|
31 | |||
|
32 | from pyramid.settings import asbool | |||
|
33 | ||||
32 | from vcsserver.lib.memory_lru_dict import LRUDict, LRUDictDebug |
|
34 | from vcsserver.lib.memory_lru_dict import LRUDict, LRUDictDebug | |
33 |
|
35 | |||
34 |
|
36 | |||
@@ -189,6 +191,16 b' class FileNamespaceBackend(PickleSeriali' | |||||
189 |
|
191 | |||
190 |
|
192 | |||
191 | class BaseRedisBackend(redis_backend.RedisBackend): |
|
193 | class BaseRedisBackend(redis_backend.RedisBackend): | |
|
194 | key_prefix = '' | |||
|
195 | ||||
|
196 | def __init__(self, arguments): | |||
|
197 | super(BaseRedisBackend, self).__init__(arguments) | |||
|
198 | self._lock_timeout = self.lock_timeout | |||
|
199 | self._lock_auto_renewal = asbool(arguments.pop("lock_auto_renewal", True)) | |||
|
200 | ||||
|
201 | if self._lock_auto_renewal and not self._lock_timeout: | |||
|
202 | # set default timeout for auto_renewal | |||
|
203 | self._lock_timeout = 30 | |||
192 |
|
204 | |||
193 | def _create_client(self): |
|
205 | def _create_client(self): | |
194 | args = {} |
|
206 | args = {} | |
@@ -254,14 +266,8 b' class BaseRedisBackend(redis_backend.Red' | |||||
254 | if self.distributed_lock: |
|
266 | if self.distributed_lock: | |
255 | lock_key = redis_backend.u('_lock_{0}').format(key) |
|
267 | lock_key = redis_backend.u('_lock_{0}').format(key) | |
256 | log.debug('Trying to acquire Redis lock for key %s', lock_key) |
|
268 | log.debug('Trying to acquire Redis lock for key %s', lock_key) | |
257 |
|
269 | return get_mutex_lock(self.client, lock_key, self._lock_timeout, | ||
258 | auto_renewal = True |
|
270 | auto_renewal=self._lock_auto_renewal) | |
259 | lock_timeout = self.lock_timeout |
|
|||
260 | if auto_renewal and not self.lock_timeout: |
|
|||
261 | # set default timeout for auto_renewal |
|
|||
262 | lock_timeout = 10 |
|
|||
263 | return get_mutex_lock(self.client, lock_key, lock_timeout, |
|
|||
264 | auto_renewal=auto_renewal) |
|
|||
265 | else: |
|
271 | else: | |
266 | return None |
|
272 | return None | |
267 |
|
273 | |||
@@ -282,11 +288,8 b' def get_mutex_lock(client, lock_key, loc' | |||||
282 | class _RedisLockWrapper(object): |
|
288 | class _RedisLockWrapper(object): | |
283 | """LockWrapper for redis_lock""" |
|
289 | """LockWrapper for redis_lock""" | |
284 |
|
290 | |||
285 | def __init__(self): |
|
291 | @classmethod | |
286 | pass |
|
292 | def get_lock(cls): | |
287 |
|
||||
288 | @property |
|
|||
289 | def lock(self): |
|
|||
290 | return redis_lock.Lock( |
|
293 | return redis_lock.Lock( | |
291 | redis_client=client, |
|
294 | redis_client=client, | |
292 | name=lock_key, |
|
295 | name=lock_key, | |
@@ -295,8 +298,17 b' def get_mutex_lock(client, lock_key, loc' | |||||
295 | strict=True, |
|
298 | strict=True, | |
296 | ) |
|
299 | ) | |
297 |
|
300 | |||
|
301 | def __init__(self): | |||
|
302 | self.lock = self.get_lock() | |||
|
303 | ||||
298 | def acquire(self, wait=True): |
|
304 | def acquire(self, wait=True): | |
299 | return self.lock.acquire(wait) |
|
305 | try: | |
|
306 | return self.lock.acquire(wait) | |||
|
307 | except redis_lock.AlreadyAcquired: | |||
|
308 | return False | |||
|
309 | except redis_lock.AlreadyStarted: | |||
|
310 | # refresh thread exists, but it also means we acquired the lock | |||
|
311 | return True | |||
300 |
|
312 | |||
301 | def release(self): |
|
313 | def release(self): | |
302 | try: |
|
314 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now