assistant: when an add fails, requeue it for later

See analysis in bug report for one way this could happen.
This commit is contained in:
Joey Hess 2013-04-23 18:23:04 -04:00
parent 53674cc3fd
commit ca72b1ac7b
2 changed files with 26 additions and 3 deletions

View file

@ -256,14 +256,14 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
| otherwise = a
add :: Change -> Assistant (Maybe Change)
add change@(InProcessAddChange { keySource = ks }) = do
add change@(InProcessAddChange { keySource = ks }) =
alertWhile' (addFileAlert $ keyFilename ks) $
liftM ret $ catchMaybeIO <~> do
sanitycheck ks $ do
key <- liftAnnex $ do
showStart "add" $ keyFilename ks
Command.Add.ingest $ Just ks
maybe failedingest (done change $ keyFilename ks) key
maybe (failedingest change) (done change $ keyFilename ks) key
where
{- Add errors tend to be transient and will be automatically
- dealt with, so don't pass to the alert code. -}
@ -306,7 +306,8 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
mkpairs k = map (\c -> (inodeCacheToKey ct c, k)) <$>
recordedInodeCache k
failedingest = do
failedingest change = do
refill [change]
liftAnnex showEndFail
return Nothing