@@ -651,8 +651,28 @@ def vcs_repo(self, version=LATEST, environment=None):
651
651
repo = backend (self , version , environment )
652
652
return repo
653
653
654
- def repo_nonblockinglock (self , version , max_lock_age = 5 ):
655
- return NonBlockingLock (project = self , version = version , max_lock_age = max_lock_age )
654
+ def repo_nonblockinglock (self , version , max_lock_age = None ):
655
+ """
656
+ Return a ``NonBlockingLock`` to acquire the lock via context manager.
657
+
658
+ :param version: project's version that want to get the lock for.
659
+ :param max_lock_age: time (in seconds) to consider the lock's age is old
660
+ and grab it anyway. It default to the ``container_time_limit`` of
661
+ the project or the default ``DOCKER_LIMITS['time']`` or
662
+ ``REPO_LOCK_SECONDS`` or 30
663
+ """
664
+ if max_lock_age is None :
665
+ max_lock_age = (
666
+ self .container_time_limit or
667
+ getattr (settings , 'DOCKER_LIMITS' , {}).get ('time' ) or
668
+ getattr (settings , 'REPO_LOCK_SECONDS' , 30 )
669
+ )
670
+
671
+ return NonBlockingLock (
672
+ project = self ,
673
+ version = version ,
674
+ max_lock_age = max_lock_age ,
675
+ )
656
676
657
677
def repo_lock (self , version , timeout = 5 , polling_interval = 5 ):
658
678
return Lock (self , version , timeout , polling_interval )
0 commit comments