simplify annex.bwlimit handling
RemoteGitConfig parsing looks for annex.bwlimit when a remote does not have a per-remote config for it, so no need for a separate gobal config. Sponsored-by: Svenne Krap on Patreon
This commit is contained in:
parent
05a097cde8
commit
798b33ba3d
6 changed files with 7 additions and 20 deletions
|
@ -18,7 +18,6 @@ import Messages.Progress
|
|||
import Utility.Metered
|
||||
import Types.NumCopies
|
||||
import Annex.Verify
|
||||
import Annex.Transfer
|
||||
|
||||
import Control.Concurrent
|
||||
|
||||
|
@ -35,7 +34,7 @@ type WithConn a c = (ClosableConnection c -> Annex (ClosableConnection c, a)) ->
|
|||
store :: RemoteGitConfig -> (MeterUpdate -> ProtoRunner Bool) -> Key -> AssociatedFile -> MeterUpdate -> Annex ()
|
||||
store gc runner k af p = do
|
||||
let sizer = KeySizer k (fmap (toRawFilePath . fst) <$> prepSendAnnex k)
|
||||
bwlimit <- bwLimit gc
|
||||
let bwlimit = remoteAnnexBwLimit gc
|
||||
metered (Just p) sizer bwlimit $ \_ p' ->
|
||||
runner p' (P2P.put k af p') >>= \case
|
||||
Just True -> return ()
|
||||
|
@ -45,7 +44,7 @@ store gc runner k af p = do
|
|||
retrieve :: RemoteGitConfig -> (MeterUpdate -> ProtoRunner (Bool, Verification)) -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> VerifyConfig -> Annex Verification
|
||||
retrieve gc runner k af dest p verifyconfig = do
|
||||
iv <- startVerifyKeyContentIncrementally verifyconfig k
|
||||
bwlimit <- bwLimit gc
|
||||
let bwlimit = remoteAnnexBwLimit gc
|
||||
metered (Just p) k bwlimit $ \m p' ->
|
||||
runner p' (P2P.get dest k iv af m p') >>= \case
|
||||
Just (True, v) -> return v
|
||||
|
|
|
@ -42,7 +42,6 @@ import Types.StoreRetrieve
|
|||
import Types.Remote
|
||||
import Annex.Verify
|
||||
import Annex.UUID
|
||||
import Annex.Transfer
|
||||
import Config
|
||||
import Config.Cost
|
||||
import Utility.Metered
|
||||
|
@ -263,7 +262,7 @@ specialRemote' cfg c storer retriever remover checkpresent baser = encr
|
|||
|
||||
displayprogress p k srcfile a
|
||||
| displayProgress cfg = do
|
||||
bwlimit <- bwLimit (gitconfig baser)
|
||||
let bwlimit = remoteAnnexBwLimit (gitconfig baser)
|
||||
metered (Just p) (KeySizer k (pure (fmap toRawFilePath srcfile))) bwlimit (const a)
|
||||
| otherwise = a p
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue