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
|
{- Exclusively locks content, while performing an action that
|
||||||
- might remove it.
|
- might remove it.
|
||||||
|
-
|
||||||
|
- If locking fails, throws an exception rather than running the action.
|
||||||
-}
|
-}
|
||||||
lockContentForRemoval :: Key -> (ContentRemovalLock -> Annex a) -> Annex a
|
lockContentForRemoval :: Key -> (ContentRemovalLock -> Annex a) -> Annex a
|
||||||
lockContentForRemoval key a = lockContentUsing lock key $
|
lockContentForRemoval key a = lockContentUsing lock key $
|
||||||
|
|
|
@ -75,7 +75,7 @@ expireUnused duration = do
|
||||||
let oldkeys = M.keys $ M.filter (tooold now) m
|
let oldkeys = M.keys $ M.filter (tooold now) m
|
||||||
forM_ oldkeys $ \k -> do
|
forM_ oldkeys $ \k -> do
|
||||||
debug ["removing old unused key", key2file k]
|
debug ["removing old unused key", key2file k]
|
||||||
liftAnnex $ do
|
liftAnnex $ tryNonAsync $ do
|
||||||
lockContentForRemoval k removeAnnex
|
lockContentForRemoval k removeAnnex
|
||||||
logStatus k InfoMissing
|
logStatus k InfoMissing
|
||||||
where
|
where
|
||||||
|
|
|
@ -377,7 +377,9 @@ keyUrls gc repo r key = map tourl locs'
|
||||||
dropKey :: Remote -> State -> Key -> Annex Bool
|
dropKey :: Remote -> State -> Key -> Annex Bool
|
||||||
dropKey r st key = do
|
dropKey r st key = do
|
||||||
repo <- getRepo r
|
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' :: Git.Repo -> Remote -> State -> Key -> Annex Bool
|
||||||
dropKey' repo r (State connpool duc _) key
|
dropKey' repo r (State connpool duc _) key
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue