Fix transfer log file locking problem when running concurrent transfers.
orElse is great, but was not the right thing to use here because waitTakeLock could retry for other reasons than the lock being held, which made tryTakeLock fail when it shouldn't. Instead, move the code to tryTakeLock and implement waitTakeLock using tryTakeLock and retry. (Also, in runTransfer, when checkSaneLock fails, dropLock to avoid leaking a lock handle.) This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
parent
df9ba3b5b4
commit
7db37ddde0
4 changed files with 60 additions and 16 deletions
|
@ -118,7 +118,9 @@ runTransfer' ignorelock t afile shouldretry transferaction = checkSecureHashes t
|
|||
void $ liftIO $ tryIO $
|
||||
writeTransferInfoFile info tfile
|
||||
return (Just lockhandle, False)
|
||||
, return (Nothing, True)
|
||||
, do
|
||||
liftIO $ dropLock lockhandle
|
||||
return (Nothing, True)
|
||||
)
|
||||
#else
|
||||
prep tfile _mode info = catchPermissionDenied (const prepfailed) $ do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue