lock before writing to the ContentIdentifier db

This commit is contained in:
Joey Hess 2019-03-04 16:47:30 -04:00
parent aaacf431d8
commit 00722ba1f8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -217,7 +217,8 @@ downloadImport remote importtreeconfig importablecontents = do
-- importablecontents (eg when it has a history),
-- they will only be downloaded once.
cidmap <- liftIO $ newTVarIO M.empty
bracket CID.openDb CID.closeDb (go cidmap importablecontents)
withExclusiveLock gitAnnexContentIdentifierLock $
bracket CID.openDb CID.closeDb (go cidmap importablecontents)
-- TODO really support concurrency; avoid donwloading the same
-- ContentIdentifier twice.
where