p2phttp support --jobs with --directory
--jobs is usually an Annex option setter, but --directory runs in IO, so would not have that available. So instead moved the option parser into the command's Options.
This commit is contained in:
parent
9f84dd82da
commit
3c18398d5a
3 changed files with 30 additions and 22 deletions
|
@ -26,6 +26,8 @@ import Types.NumCopies
|
|||
import Types.WorkerPool
|
||||
import Annex.WorkerPool
|
||||
import Annex.BranchState
|
||||
import Annex.Concurrent
|
||||
import Types.Concurrency
|
||||
import Types.Cluster
|
||||
import CmdLine.Action (startConcurrency)
|
||||
import Utility.ThreadScheduler
|
||||
|
@ -551,11 +553,13 @@ dropLock lckid st = do
|
|||
Nothing -> return ()
|
||||
Just locker -> wait (lockerThread locker)
|
||||
|
||||
getAnnexWorkerPool :: (AnnexWorkerPool -> Annex a) -> Annex a
|
||||
getAnnexWorkerPool a = startConcurrency transferStages $
|
||||
Annex.getState Annex.workers >>= \case
|
||||
Nothing -> giveup "Use -Jn or set annex.jobs to configure the number of worker threads."
|
||||
Just wp -> a wp
|
||||
withAnnexWorkerPool :: (Maybe Concurrency) -> (AnnexWorkerPool -> Annex a) -> Annex a
|
||||
withAnnexWorkerPool mc a = do
|
||||
maybe noop (setConcurrency . ConcurrencyCmdLine) mc
|
||||
startConcurrency transferStages $
|
||||
Annex.getState Annex.workers >>= \case
|
||||
Nothing -> giveup "Use -Jn or set annex.jobs to configure the number of worker threads."
|
||||
Just wp -> a wp
|
||||
|
||||
inAnnexWorker :: PerRepoServerState -> Annex a -> IO (Either SomeException a)
|
||||
inAnnexWorker st = inAnnexWorker' (annexWorkerPool st)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue