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.
This commit is contained in:
parent
7db37ddde0
commit
e1cf095ae8
4 changed files with 40 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue