differentiate between concurrency enabled at command line and by git config

The latter should not affect --batch mode.
This commit is contained in:
Joey Hess 2020-09-16 11:41:28 -04:00
parent 8471df3b6d
commit 77c42782d0
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 46 additions and 21 deletions

View file

@ -7,10 +7,18 @@
module Annex.Concurrent.Utility where
import Annex
import Types.Concurrency
import GHC.Conc
getConcurrency :: Annex Concurrency
getConcurrency = getConcurrency' <$> getState concurrency
getConcurrency' :: ConcurrencySetting -> Concurrency
getConcurrency' (ConcurrencyCmdLine c) = c
getConcurrency' (ConcurrencyGitConfig c) = c
{- Honor the requested level of concurrency, but only up to the number of
- CPU cores. Useful for things that are known to be CPU bound. -}
concurrencyUpToCpus :: Concurrency -> IO Int