Skip to content

Commit

Permalink
version with no repetition at all
Browse files Browse the repository at this point in the history
  • Loading branch information
bernt-matthias committed May 10, 2017
1 parent 3895e95 commit 616c891
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions lib/galaxy/tools/deps/installable.py
Expand Up @@ -67,16 +67,11 @@ def _check():
if not os.path.lexists(parent_path):
os.mkdir(parent_path)

import time
MAX_TRIES = 10

for i in range( MAX_TRIES ):
try:
if auto_init and os.access(parent_path, os.W_OK):
with FileLock(os.path.join(parent_path, desc.lower())):
return _check()
else:
try:
if auto_init and os.access(parent_path, os.W_OK):
with FileLock(os.path.join(parent_path, desc.lower())):
return _check()
except FileLockException:
time.sleep(1)
raise Exception("Failed to get file lock for %s for %s times" % (os.path.join(parent_path, desc.lower()), MAX_TRIES))
else:
return _check()
except FileLockException:
raise Exception("Failed to get file lock for %s" % os.path.join(parent_path, desc.lower()))

0 comments on commit 616c891

Please sign in to comment.