import: Retry downloads that fail
Also, using the transfer machinery for this makes eg, git-annex info show in-progress imports, and makes --notify-start/finish work.
This commit is contained in:
parent
46eb48d7c0
commit
2bb933eb60
3 changed files with 27 additions and 11 deletions
|
@ -35,6 +35,7 @@ import Annex.Content
|
|||
import Annex.Export
|
||||
import Annex.RemoteTrackingBranch
|
||||
import Annex.HashObject
|
||||
import Annex.Transfer
|
||||
import Command
|
||||
import Backend
|
||||
import Types.Key
|
||||
|
@ -411,8 +412,13 @@ importKeys remote importtreeconfig importcontent importablecontents = do
|
|||
const runimport
|
||||
|
||||
dodownload cidmap db (loc, (cid, sz)) largematcher = do
|
||||
f <- locworktreefile loc
|
||||
let af = AssociatedFile (Just f)
|
||||
let downloader tmpfile p = do
|
||||
k <- Remote.retrieveExportWithContentIdentifier ia loc cid tmpfile (mkkey loc tmpfile largematcher) p
|
||||
k <- Remote.retrieveExportWithContentIdentifier
|
||||
ia loc cid tmpfile
|
||||
(mkkey f tmpfile largematcher)
|
||||
p
|
||||
case keyGitSha k of
|
||||
Nothing -> do
|
||||
ok <- moveAnnex k tmpfile
|
||||
|
@ -431,16 +437,17 @@ importKeys remote importtreeconfig importcontent importablecontents = do
|
|||
warning (show e)
|
||||
return Nothing
|
||||
checkDiskSpaceToGet tmpkey Nothing $
|
||||
notifyTransfer Download af $
|
||||
download (Remote.uuid remote) tmpkey af stdRetry $ \p ->
|
||||
withTmp tmpkey $ \tmpfile ->
|
||||
metered Nothing tmpkey $
|
||||
metered (Just p) tmpkey $
|
||||
const (rundownload tmpfile)
|
||||
where
|
||||
tmpkey = importKey cid sz
|
||||
|
||||
ia = Remote.importActions remote
|
||||
|
||||
mkkey loc tmpfile largematcher = do
|
||||
f <- fromRepo $ fromTopFilePath $ locworktreefilename loc
|
||||
mkkey f tmpfile largematcher = do
|
||||
matcher <- largematcher (fromRawFilePath f)
|
||||
let mi = MatchingFile FileInfo
|
||||
{ matchFile = f
|
||||
|
@ -458,7 +465,8 @@ importKeys remote importtreeconfig importcontent importablecontents = do
|
|||
fst <$> genKey ks nullMeterUpdate backend
|
||||
else gitShaKey <$> hashFile tmpfile
|
||||
|
||||
locworktreefilename loc = asTopFilePath $ case importtreeconfig of
|
||||
locworktreefile loc = fromRepo $ fromTopFilePath $ asTopFilePath $
|
||||
case importtreeconfig of
|
||||
ImportTree -> fromImportLocation loc
|
||||
ImportSubTree subdir _ ->
|
||||
getTopFilePath subdir P.</> fromImportLocation loc
|
||||
|
|
|
@ -28,6 +28,7 @@ git-annex (8.20200815) UNRELEASED; urgency=medium
|
|||
to 5, to avoid some unusual edge cases where too much retrying could
|
||||
result in far more data transfer than makes sense.
|
||||
* Retry transfers to exporttree=yes remotes same as for other remotes.
|
||||
* import: Retry downloads that fail, same as is done for downloads generally.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Fri, 14 Aug 2020 14:57:45 -0400
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 3"""
|
||||
date="2020-09-04T17:40:07Z"
|
||||
content="""
|
||||
Both retry now.
|
||||
"""]]
|
Loading…
Reference in a new issue