diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-23 13:27:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-23 13:27:13 -0400 |
commit | df07ccf404bf6a950fe0a0a31f315486c510a2f0 (patch) | |
tree | a7188982ebb24b9ca0122c7516143c5089aef197 /Command | |
parent | d4055b3dd2999a75381c4cae2ed30a7dcd32d3f2 (diff) |
make the assistant retry failed transfers
When a transfer fails, the progress info can be used to intelligently
retry it. If the transfer managed to make some progress, but did not
fully complete, then there's a good chance that a retry will finish it
(or at least make more progress).
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Get.hs | 2 | ||||
-rw-r--r-- | Command/Move.hs | 4 | ||||
-rw-r--r-- | Command/SendKey.hs | 4 | ||||
-rw-r--r-- | Command/TransferKey.hs | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/Command/Get.hs b/Command/Get.hs index 18153ce88..ab0e60b41 100644 --- a/Command/Get.hs +++ b/Command/Get.hs @@ -66,7 +66,7 @@ getKeyFile key file dest = dispatch =<< Remote.keyPossibilities key either (const False) id <$> Remote.hasKey r key | otherwise = return True docopy r continue = do - ok <- download (Remote.uuid r) key (Just file) $ do + ok <- download (Remote.uuid r) key (Just file) noRetry $ do showAction $ "from " ++ Remote.name r Remote.retrieveKeyFile r key (Just file) dest if ok then return ok else continue diff --git a/Command/Move.hs b/Command/Move.hs index 7955cecd3..36242f45c 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -89,7 +89,7 @@ toPerform dest move key file = moveLock move key $ do stop Right False -> do showAction $ "to " ++ Remote.name dest - ok <- upload (Remote.uuid dest) key (Just file) $ + ok <- upload (Remote.uuid dest) key (Just file) noRetry $ Remote.storeKey dest key (Just file) if ok then finish @@ -138,7 +138,7 @@ fromPerform src move key file = moveLock move key $ , handle move =<< go ) where - go = download (Remote.uuid src) key (Just file) $ do + go = download (Remote.uuid src) key (Just file) noRetry $ do showAction $ "from " ++ Remote.name src getViaTmp key $ Remote.retrieveKeyFile src key (Just file) handle _ False = stop -- failed diff --git a/Command/SendKey.hs b/Command/SendKey.hs index e5d4c7e6e..2aae1ab90 100644 --- a/Command/SendKey.hs +++ b/Command/SendKey.hs @@ -24,7 +24,7 @@ seek = [withKeys start] start :: Key -> CommandStart start key = ifM (inAnnex key) - ( fieldTransfer Upload key $ \p -> do + ( fieldTransfer Upload key $ \_p -> do file <- inRepo $ gitAnnexLocation key liftIO $ rsyncServerSend file , do @@ -36,7 +36,7 @@ fieldTransfer :: Direction -> Key -> (MeterUpdate -> Annex Bool) -> CommandStart fieldTransfer direction key a = do afile <- Fields.getField Fields.associatedFile ok <- maybe (a $ const noop) - (\u -> runTransfer (Transfer direction (toUUID u) key) afile a) + (\u -> runTransfer (Transfer direction (toUUID u) key) afile noRetry a) =<< Fields.getField Fields.remoteUUID if ok then liftIO exitSuccess diff --git a/Command/TransferKey.hs b/Command/TransferKey.hs index 793dbeb56..a308e0175 100644 --- a/Command/TransferKey.hs +++ b/Command/TransferKey.hs @@ -43,7 +43,7 @@ start to from file key = toPerform :: Remote -> Key -> AssociatedFile -> CommandPerform toPerform remote key file = next $ - upload (uuid remote) key file $ \p -> do + upload (uuid remote) key file forwardRetry $ \p -> do ok <- Remote.storeKey remote key file p when ok $ Remote.logStatus remote key InfoPresent @@ -51,5 +51,5 @@ toPerform remote key file = next $ fromPerform :: Remote -> Key -> AssociatedFile -> CommandPerform fromPerform remote key file = next $ - download (uuid remote) key file $ + download (uuid remote) key file forwardRetry $ getViaTmp key $ Remote.retrieveKeyFile remote key file |