catch lockContentForRemoval exception

removeKey should not throw exceptions, so catch exception there

In Assistant.Unused, keep trying to drop other keys if one drop fails
This commit is contained in:
Joey Hess 2018-11-15 15:38:55 -04:00
parent 2df31610ed
commit 370757087d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 6 additions and 2 deletions

View file

@ -220,6 +220,8 @@ lockContentShared key a = lockContentUsing lock key $ ifM (inAnnex key)
{- Exclusively locks content, while performing an action that
- might remove it.
-
- If locking fails, throws an exception rather than running the action.
-}
lockContentForRemoval :: Key -> (ContentRemovalLock -> Annex a) -> Annex a
lockContentForRemoval key a = lockContentUsing lock key $

View file

@ -75,7 +75,7 @@ expireUnused duration = do
let oldkeys = M.keys $ M.filter (tooold now) m
forM_ oldkeys $ \k -> do
debug ["removing old unused key", key2file k]
liftAnnex $ do
liftAnnex $ tryNonAsync $ do
lockContentForRemoval k removeAnnex
logStatus k InfoMissing
where

View file

@ -377,7 +377,9 @@ keyUrls gc repo r key = map tourl locs'
dropKey :: Remote -> State -> Key -> Annex Bool
dropKey r st key = do
repo <- getRepo r
dropKey' repo r st key
catchNonAsync
(dropKey' repo r st key)
(\e -> warning (show e) >> return False)
dropKey' :: Git.Repo -> Remote -> State -> Key -> Annex Bool
dropKey' repo r (State connpool duc _) key