summaryrefslogtreecommitdiff
path: root/Assistant/Threads
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-04 19:56:32 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-04 19:56:32 -0400
commitcd699ff50b8434b52e2f51d06414e8431b407482 (patch)
tree77291f6d6f6c340c41f9da5b3bbfeae4117d7764 /Assistant/Threads
parentbdbfe36e945e97d66c965bc7227d1457372bce32 (diff)
fix last zombies in the assistant
Made Git.LsFiles return cleanup actions, and everything waits on processes now, except of course for Seek.
Diffstat (limited to 'Assistant/Threads')
-rw-r--r--Assistant/Threads/Committer.hs5
-rw-r--r--Assistant/Threads/SanityChecker.hs3
-rw-r--r--Assistant/Threads/TransferScanner.hs3
3 files changed, 7 insertions, 4 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs
index 8fadafbd0..6b036d09a 100644
--- a/Assistant/Threads/Committer.hs
+++ b/Assistant/Threads/Committer.hs
@@ -5,7 +5,7 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE CPP #-}
+{-# LANGUAGE CPP, BangPatterns #-}
module Assistant.Threads.Committer where
@@ -174,8 +174,9 @@ handleAdds delayadd st changechan transferqueue dstatus cs = returnWhen (null in
findnew [] = return []
findnew pending = do
- newfiles <- runThreadState st $
+ (!newfiles, cleanup) <- runThreadState st $
inRepo (Git.LsFiles.notInRepo False $ map changeFile pending)
+ void cleanup
-- note: timestamp info is lost here
let ts = changeTime (pending !! 0)
return $ map (PendingAddChange ts) newfiles
diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs
index 148ae1435..f01b63de3 100644
--- a/Assistant/Threads/SanityChecker.hs
+++ b/Assistant/Threads/SanityChecker.hs
@@ -76,7 +76,7 @@ check :: ThreadState -> DaemonStatusHandle -> TransferQueue -> ChangeChan -> IO
check st dstatus transferqueue changechan = do
g <- runThreadState st $ fromRepo id
-- Find old unstaged symlinks, and add them to git.
- unstaged <- Git.LsFiles.notInRepo False ["."] g
+ (unstaged, cleanup) <- Git.LsFiles.notInRepo False ["."] g
now <- getPOSIXTime
forM_ unstaged $ \file -> do
ms <- catchMaybeIO $ getSymbolicLinkStatus file
@@ -85,6 +85,7 @@ check st dstatus transferqueue changechan = do
| isSymbolicLink s ->
addsymlink file ms
_ -> noop
+ void cleanup
return True
where
toonew timestamp now = now < (realToFrac (timestamp + slop) :: POSIXTime)
diff --git a/Assistant/Threads/TransferScanner.hs b/Assistant/Threads/TransferScanner.hs
index d3436bd25..cb02ed2f2 100644
--- a/Assistant/Threads/TransferScanner.hs
+++ b/Assistant/Threads/TransferScanner.hs
@@ -94,8 +94,9 @@ expensiveScan st dstatus transferqueue rs = unless onlyweb $ do
liftIO $ debug thisThread ["starting scan of", show visiblers]
void $ alertWhile dstatus (scanAlert visiblers) $ do
g <- runThreadState st $ fromRepo id
- files <- LsFiles.inRepo [] g
+ (files, cleanup) <- LsFiles.inRepo [] g
go files
+ void cleanup
return True
liftIO $ debug thisThread ["finished scan of", show visiblers]
where