mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
lock: loop a finite number of times in trylock (issue4787)
..before falling back to lock, which will sleep. This only addresses the CPU consumption of the reported issue.
This commit is contained in:
parent
d439794357
commit
228882fcf1
@ -83,7 +83,9 @@ class lock(object):
|
||||
if lock._host is None:
|
||||
lock._host = socket.gethostname()
|
||||
lockname = '%s:%s' % (lock._host, self.pid)
|
||||
while not self.held:
|
||||
retry = 5
|
||||
while not self.held and retry:
|
||||
retry -= 1
|
||||
try:
|
||||
self.vfs.makelock(lockname, self.f)
|
||||
self.held = 1
|
||||
|
Loading…
Reference in New Issue
Block a user