diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-29 16:49:47 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-29 16:49:47 -0400 |
commit | 2960a8011484fa3dad1cff55e8e412f4d4b1db84 (patch) | |
tree | c36b30274a014f5a7d22dd072a3756a9d4b817cc /Assistant/Threads/Committer.hs | |
parent | 0864097c212131b477b41907b3d59dacf6bc4fe9 (diff) |
lift alertWhile
Diffstat (limited to 'Assistant/Threads/Committer.hs')
-rw-r--r-- | Assistant/Threads/Committer.hs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs index 7bcdaa836..b3a737872 100644 --- a/Assistant/Threads/Committer.hs +++ b/Assistant/Threads/Committer.hs @@ -58,8 +58,7 @@ commitThread = NamedThread "Committer" $ do , show (length readychanges) , "changes" ] - dstatus <- getAssistant daemonStatusHandle - void $ alertWhile dstatus commitAlert <~> + void $ alertWhile commitAlert $ liftAnnex commitStaged recordCommit <<~ commitChan else refill readychanges @@ -177,21 +176,19 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do add :: Change -> Assistant (Maybe Change) add change@(InProcessAddChange { keySource = ks }) = do - dstatus <- getAssistant daemonStatusHandle - alertWhile' dstatus (addFileAlert $ keyFilename ks) <~> add' change ks - add _ = return Nothing - - add' change ks = liftM ret $ catchMaybeIO <~> do - sanitycheck ks $ do - key <- liftAnnex $ do - showStart "add" $ keyFilename ks - Command.Add.ingest ks - done (finishedChange change) (keyFilename ks) key + alertWhile' (addFileAlert $ keyFilename ks) $ + liftM ret $ catchMaybeIO <~> do + sanitycheck ks $ do + key <- liftAnnex $ do + showStart "add" $ keyFilename ks + Command.Add.ingest ks + done (finishedChange 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. -} ret (Just j@(Just _)) = (True, j) ret _ = (True, Nothing) + add _ = return Nothing done _ _ Nothing = do liftAnnex showEndFail |