diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-08-13 14:20:28 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-08-13 14:20:28 -0400 |
commit | 1d71ad072e13c8ed1cb8b34367b57d59e651f0a9 (patch) | |
tree | 6114f4eb7d0069b415af422a741e4b669d008055 /Remote | |
parent | 39fe17b8e4afc8a79000338dd9758cc71fd97677 (diff) |
Sped up downloads of files from ssh remotes, reducing the non-data-transfer overhead 6x.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Git.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index 170bd7cfa..ad4449b46 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -58,6 +58,7 @@ import Control.Concurrent import Control.Concurrent.MSampleVar import qualified Data.Map as M import Network.URI +import System.Log.Logger remote :: RemoteType remote = RemoteType { @@ -445,9 +446,14 @@ copyFromRemote' r key file dest meterupdate let feeder = \n -> do meterupdate n writeSV v (fromBytesProcessed n) - let cleanup = do + + -- It can easily take 0.3 seconds to clean up after + -- the transferinfo, and all that's involved is shutting + -- down the process and associated thread cleanly. So, + -- do it in the background. + let cleanup = forkIO $ do void $ tryIO $ killThread tid - tryNonAsync $ + void $ tryNonAsync $ maybe noop (void . waitForProcess) =<< tryTakeMVar pidv bracketIO noop (const cleanup) (const $ a feeder) |