diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-09 12:57:42 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-09 12:57:42 -0400 |
commit | cac7297784a4eb953f0d6108d7e67e97be9285ad (patch) | |
tree | ca0098b875209945e15de2f63f52463487eb5e43 /Annex | |
parent | 70ad04b5fc21d39bdae85b08ec948359a28021e6 (diff) |
disentangle concurrency and message type
This makes -Jn work with --json and --quiet, where before
setting -Jn disabled those options.
Concurrent json output is currently a mess though since threads output
chunks over top of one-another.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Transfer.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Annex/Transfer.hs b/Annex/Transfer.hs index 6ed8ca761..323600e96 100644 --- a/Annex/Transfer.hs +++ b/Annex/Transfer.hs @@ -28,6 +28,7 @@ import Utility.Metered import Annex.LockPool import Types.Remote (Verification(..)) import qualified Types.Remote as Remote +import Types.Concurrency import Control.Concurrent import qualified Data.Set as S @@ -180,11 +181,11 @@ forwardRetry old new = bytesComplete old < bytesComplete new - increase total transfer speed. -} pickRemote :: Observable v => [Remote] -> (Remote -> Annex v) -> Annex v -pickRemote l a = go l =<< Annex.getState Annex.concurrentjobs +pickRemote l a = go l =<< Annex.getState Annex.concurrency where go [] _ = return observeFailure go (r:[]) _ = a r - go rs (Just n) | n > 1 = do + go rs (Concurrent n) | n > 1 = do mv <- Annex.getState Annex.activeremotes active <- liftIO $ takeMVar mv let rs' = sortBy (inactiveFirst active) rs @@ -193,7 +194,7 @@ pickRemote l a = go l =<< Annex.getState Annex.concurrentjobs ok <- a r if observeBool ok then return ok - else go rs Nothing + else go rs NonConcurrent goconcurrent mv active [] = do liftIO $ putMVar mv active return observeFailure |