From 00722ba1f83e93f9286dc0b2e919ceb1c7e88643 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 4 Mar 2019 16:47:30 -0400 Subject: [PATCH] lock before writing to the ContentIdentifier db --- Annex/Import.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Annex/Import.hs b/Annex/Import.hs index effcdea256..d9c85d88cc 100644 --- a/Annex/Import.hs +++ b/Annex/Import.hs @@ -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