Display a message when git-annex has to wait for a pid lock file held by another process

This commit is contained in:
Joey Hess 2020-08-26 13:05:34 -04:00
parent b24ba92231
commit b68f214312
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 69 additions and 32 deletions

View file

@ -1,7 +1,7 @@
{- Wraps Utility.LockPool, making pid locks be used when git-annex is so
- configured.
-
- Copyright 2015 Joey Hess <id@joeyh.name>
- Copyright 2015-2020 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -31,6 +31,7 @@ import Utility.LockFile.Posix (openLockFile)
import Utility.LockPool.STM (LockFile)
import Utility.LockFile.LockStatus
import Config (pidLockFile)
import Messages (warning)
import System.Posix
@ -72,9 +73,8 @@ pidLock m f posixlock = debugLocks $ go =<< pidLockFile
go Nothing = liftIO posixlock
go (Just pidlock) = do
timeout <- annexPidLockTimeout <$> Annex.getGitConfig
liftIO $ do
dummyPosixLock m f
Pid.waitLock timeout pidlock
liftIO $ dummyPosixLock m f
Pid.waitLock timeout pidlock warning
tryPidLock :: Maybe FileMode -> LockFile -> IO (Maybe LockHandle) -> Annex (Maybe LockHandle)
tryPidLock m f posixlock = debugLocks $ liftIO . go =<< pidLockFile