From 26aad24fd340897cfc2261ec477a6802b05bbcf6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Dec 2020 12:09:49 -0400 Subject: [PATCH] simplify As the only blocking operation now is threadDelaySeconds, no need to calculate actual time and actual expected minimum size. --- Annex/TransferrerPool.hs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Annex/TransferrerPool.hs b/Annex/TransferrerPool.hs index 9f7880bd52..ee84e50e85 100644 --- a/Annex/TransferrerPool.hs +++ b/Annex/TransferrerPool.hs @@ -31,7 +31,6 @@ import Control.Concurrent import Control.Concurrent.Async import Control.Concurrent.STM hiding (check) import Control.Monad.IO.Class (MonadIO) -import Data.Time.Clock.POSIX import System.Log.Logger (debugM) import qualified Data.Map as M #ifndef mingw32_HOST_OS @@ -183,7 +182,6 @@ detectStalls Nothing _ _ = noop detectStalls (Just (StallDetection minsz duration)) metervar onstall = go Nothing where go st = do - starttm <- getPOSIXTime threadDelaySeconds (Seconds (fromIntegral (durationSeconds duration))) -- Get whatever progress value was reported last, if any. v <- atomically $ fmap fromBytesProcessed @@ -198,15 +196,8 @@ detectStalls (Just (StallDetection minsz duration)) metervar onstall = go Nothin -- started and is at a smaller value than -- the previous one. | prev > sofar -> cont - | otherwise -> do - endtm <- getPOSIXTime - let actualduration = endtm - starttm - let sz = sofar - prev - let expectedsz = (minsz * durationSeconds duration) - `div` max 1 (ceiling actualduration) - if sz < expectedsz - then onstall - else cont + | sofar - prev < minsz -> onstall + | otherwise -> cont {- Starts a new git-annex transfer process, setting up handles - that will be used to communicate with it. -} -- 2.30.2