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:
parent
2df31610ed
commit
370757087d
3 changed files with 6 additions and 2 deletions
|
@ -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 $
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue