avoid spawning file size polling thread when not in -J mode
This commit is contained in:
parent
e97fce35a6
commit
3449c0e8ec
2 changed files with 11 additions and 5 deletions
|
@ -660,10 +660,8 @@ saveState nocommit = doSideAction $ do
|
||||||
|
|
||||||
{- Downloads content from any of a list of urls. -}
|
{- Downloads content from any of a list of urls. -}
|
||||||
downloadUrl :: Key -> MeterUpdate -> [Url.URLString] -> FilePath -> Annex Bool
|
downloadUrl :: Key -> MeterUpdate -> [Url.URLString] -> FilePath -> Annex Bool
|
||||||
downloadUrl k p urls file =
|
downloadUrl k p urls file = concurrentMeteredFile file (Just p) k $
|
||||||
concurrentMetered (Just p) k $ \p' ->
|
go =<< annexWebDownloadCommand <$> Annex.getGitConfig
|
||||||
watchFileSize file p' $
|
|
||||||
go =<< annexWebDownloadCommand <$> Annex.getGitConfig
|
|
||||||
where
|
where
|
||||||
go Nothing = do
|
go Nothing = do
|
||||||
a <- ifM commandProgressDisabled
|
a <- ifM commandProgressDisabled
|
||||||
|
|
|
@ -70,7 +70,15 @@ concurrentMetered :: Maybe MeterUpdate -> Key -> (MeterUpdate -> Annex a) -> Ann
|
||||||
concurrentMetered combinemeterupdate key a = withOutputType go
|
concurrentMetered combinemeterupdate key a = withOutputType go
|
||||||
where
|
where
|
||||||
go (ConcurrentOutput _) = metered combinemeterupdate key a
|
go (ConcurrentOutput _) = metered combinemeterupdate key a
|
||||||
go _ = a (fromMaybe (const noop) combinemeterupdate)
|
go _ = a (fromMaybe nullMeterUpdate combinemeterupdate)
|
||||||
|
|
||||||
|
{- Poll file size to display meter, but only for concurrent output. -}
|
||||||
|
concurrentMeteredFile :: FilePath -> Maybe MeterUpdate -> Key -> Annex a -> Annex a
|
||||||
|
concurrentMeteredFile file combinemeterupdate key a = withOutputType go
|
||||||
|
where
|
||||||
|
go (ConcurrentOutput _) = metered combinemeterupdate key $ \p ->
|
||||||
|
watchFileSize file p a
|
||||||
|
go _ = a
|
||||||
|
|
||||||
{- Progress dots. -}
|
{- Progress dots. -}
|
||||||
showProgressDots :: Annex ()
|
showProgressDots :: Annex ()
|
||||||
|
|
Loading…
Add table
Reference in a new issue