diff options
author | Joey Hess <joey@kitenet.net> | 2013-03-28 17:03:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-03-28 17:04:37 -0400 |
commit | cf07a2c4125fd65243e6893f7a9d4dfdcf4c2981 (patch) | |
tree | abcba7bf62ce3f7440f02ff6a588d6a2b8c20eba /Messages.hs | |
parent | 577128e9b81b4efd5d9849428c95b70ccf5f7f2d (diff) |
webapp: Progess bar fixes for many types of special remotes.
There was confusion in different parts of the progress bar code about
whether an update contained the total number of bytes transferred, or the
number of bytes transferred since the last update. One way this bug
showed up was progress bars that seemed to stick at zero for a long time.
In order to fix it comprehensively, I add a new BytesProcessed data type,
that is explicitly a total quantity of bytes, not a delta.
Note that this doesn't necessarily fix every problem with progress bars.
Particularly, buffering can now cause progress bars to seem to run ahead
of transfers, reaching 100% when data is still being uploaded.
Diffstat (limited to 'Messages.hs')
-rw-r--r-- | Messages.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Messages.hs b/Messages.hs index d79c91aa03..13b786a318 100644 --- a/Messages.hs +++ b/Messages.hs @@ -43,14 +43,15 @@ import System.Log.Logger import System.Log.Formatter import System.Log.Handler (setFormatter, LogHandler) import System.Log.Handler.Simple +import qualified Data.Set as S import Common import Types import Types.Messages +import qualified Messages.JSON as JSON import Types.Key import qualified Annex -import qualified Messages.JSON as JSON -import qualified Data.Set as S +import Utility.Metered showStart :: String -> String -> Annex () showStart command file = handle (JSON.start command $ Just file) $ @@ -86,7 +87,7 @@ meteredBytes combinemeterupdate size a = withOutputType go meter <- liftIO $ newMeter progress "B" 25 (renderNums binaryOpts 1) showOutput r <- a $ \n -> liftIO $ do - incrP progress n + setP progress $ fromBytesProcessed n displayMeter stdout meter maybe noop (\m -> m n) combinemeterupdate liftIO $ clearMeter stdout meter |