aboutsummaryrefslogtreecommitdiff
path: root/CmdLine
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-05-25 18:27:01 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-05-25 18:28:23 -0400
commit893f5c6b0069bfed1750a58ee6aa38d2d98b1b18 (patch)
tree7b20f41fa2bd987888f08314c755d53d477c055b /CmdLine
parent9785222714d65ded2274723c8b0a210c6152ea36 (diff)
Avoid concurrent git-config setting problem when running concurrent threads.
See my comment. This only avoids the problem for -J; two git-annex processes started at the same time could still both try to write to .git/config and one fail. That would be very unlikely though, and it doesn't really seem worth adding an additional layer of locking around .git/config. This commit was supported by the NSF-funded DataLad project.
Diffstat (limited to 'CmdLine')
-rw-r--r--CmdLine/Action.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/CmdLine/Action.hs b/CmdLine/Action.hs
index 27621e445..75c9e9471 100644
--- a/CmdLine/Action.hs
+++ b/CmdLine/Action.hs
@@ -16,6 +16,7 @@ import Types.Command
import Types.Concurrency
import Messages.Concurrent
import Types.Messages
+import Remote.List
import Control.Concurrent.Async
import Control.Exception (throwIO)
@@ -57,6 +58,12 @@ commandAction a = go =<< Annex.getState Annex.concurrency
ws <- Annex.getState Annex.workers
(st, ws') <- if null ws
then do
+ -- Generate the remote list now, to avoid
+ -- each thread generating it, which would
+ -- be more expensive and could cause
+ -- threads to contend over eg, calls to
+ -- setConfig.
+ _ <- remoteList
st <- dupState
return (st, replicate (n-1) (Left st))
else do