Avoid accumulating transfer failure log files unless the assistant is being used.

Only the assistant uses these, and only the assistant cleans them up, so
make only git annex transferkeys write them,

There is one behavior change from this. If glacier is being used, and a
manual git annex get --from glacier fails because the file isn't available
yet, the assistant will no longer later see that failed transfer file and
retry the get. Hope no-one depended on that old behavior.
This commit is contained in:
Joey Hess 2015-05-12 15:50:03 -04:00
parent a812d598ef
commit 61ccf95004
9 changed files with 38 additions and 23 deletions

View file

@ -223,7 +223,7 @@ addUrlFileQuvi relaxed quviurl videourl file = do
tmp <- fromRepo $ gitAnnexTmpObjectLocation key
showOutput
ok <- Transfer.notifyTransfer Transfer.Download (Just file) $
Transfer.download webUUID key (Just file) Transfer.forwardRetry $ const $ do
Transfer.download webUUID key (Just file) Transfer.forwardRetry Transfer.noObserver $ const $ do
liftIO $ createDirectoryIfMissing True (parentDir tmp)
downloadUrl [videourl] tmp
if ok
@ -297,7 +297,7 @@ downloadWith downloader dummykey u url file =
)
where
runtransfer tmp = Transfer.notifyTransfer Transfer.Download (Just file) $
Transfer.download u dummykey (Just file) Transfer.forwardRetry $ \p -> do
Transfer.download u dummykey (Just file) Transfer.forwardRetry Transfer.noObserver $ \p -> do
liftIO $ createDirectoryIfMissing True (parentDir tmp)
downloader tmp p

View file

@ -90,6 +90,6 @@ getKeyFile' key afile dest = dispatch
| Remote.hasKeyCheap r =
either (const False) id <$> Remote.hasKey r key
| otherwise = return True
docopy r = download (Remote.uuid r) key afile noRetry $ \p -> do
docopy r = download (Remote.uuid r) key afile noRetry noObserver $ \p -> do
showAction $ "from " ++ Remote.name r
Remote.retrieveKeyFile r key afile dest p

View file

@ -95,7 +95,7 @@ toPerform dest move key afile fastcheck isthere =
Right False -> do
showAction $ "to " ++ Remote.name dest
ok <- notifyTransfer Upload afile $
upload (Remote.uuid dest) key afile noRetry $
upload (Remote.uuid dest) key afile noRetry noObserver $
Remote.storeKey dest key afile
if ok
then do
@ -152,7 +152,7 @@ fromPerform src move key afile = ifM (inAnnex key)
)
where
go = notifyTransfer Download afile $
download (Remote.uuid src) key afile noRetry $ \p -> do
download (Remote.uuid src) key afile noRetry noObserver $ \p -> do
showAction $ "from " ++ Remote.name src
getViaTmp key $ \t -> Remote.retrieveKeyFile src key afile t p
dispatch _ False = stop -- failed

View file

@ -44,7 +44,7 @@ fieldTransfer :: Direction -> Key -> (MeterUpdate -> Annex Bool) -> CommandStart
fieldTransfer direction key a = do
afile <- Fields.getField Fields.associatedFile
ok <- maybe (a $ const noop)
(\u -> runner (Transfer direction (toUUID u) key) afile noRetry a)
(\u -> runner (Transfer direction (toUUID u) key) afile noRetry noObserver a)
=<< Fields.getField Fields.remoteUUID
liftIO $ exitBool ok
where

View file

@ -42,7 +42,7 @@ start to from file key =
toPerform :: Remote -> Key -> AssociatedFile -> CommandPerform
toPerform remote key file = go Upload file $
upload (uuid remote) key file forwardRetry $ \p -> do
upload (uuid remote) key file forwardRetry noObserver $ \p -> do
ok <- Remote.storeKey remote key file p
when ok $
Remote.logStatus remote key InfoPresent
@ -50,7 +50,7 @@ toPerform remote key file = go Upload file $
fromPerform :: Remote -> Key -> AssociatedFile -> CommandPerform
fromPerform remote key file = go Upload file $
download (uuid remote) key file forwardRetry $ \p ->
download (uuid remote) key file forwardRetry noObserver $ \p ->
getViaTmp key $ \t -> Remote.retrieveKeyFile remote key file t p
go :: Direction -> AssociatedFile -> (NotifyWitness -> Annex Bool) -> CommandPerform

View file

@ -36,14 +36,17 @@ start = do
where
runner (TransferRequest direction remote key file)
| direction == Upload = notifyTransfer direction file $
upload (Remote.uuid remote) key file forwardRetry $ \p -> do
upload (Remote.uuid remote) key file forwardRetry observer $ \p -> do
ok <- Remote.storeKey remote key file p
when ok $
Remote.logStatus remote key InfoPresent
return ok
| otherwise = notifyTransfer direction file $
download (Remote.uuid remote) key file forwardRetry $ \p ->
download (Remote.uuid remote) key file forwardRetry observer $ \p ->
getViaTmp key $ \t -> Remote.retrieveKeyFile remote key file t p
observer False t info = recordFailedTransfer t info
observer True _ _ = noop
runRequests
:: Handle