Skip to content

Commit 3effdd4

Browse files
committed
Split transaction into iteration
1 parent 2cc0111 commit 3effdd4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ garbageCollectKeys :: String -> Int -> CheckParents -> [(Key, Int)] -> Action [K
787787
garbageCollectKeys label maxAge checkParents agedKeys = do
788788
start <- liftIO offsetTime
789789
ShakeExtras{state, dirtyKeys, lspEnv, logger, ideTesting} <- getShakeExtras
790-
(n::Int, garbage) <- liftIO $ atomically $
790+
(n::Int, garbage) <- liftIO $
791791
foldM (removeDirtyKey dirtyKeys state) (0,[]) agedKeys
792792
t <- liftIO start
793793
when (n>0) $ liftIO $ do
@@ -804,10 +804,11 @@ garbageCollectKeys label maxAge checkParents agedKeys = do
804804
| age > maxAge
805805
, Just (kt,_) <- fromKeyType k
806806
, not(kt `HSet.member` preservedKeys checkParents)
807-
= do gotIt <- STM.focus (Focus.member <* Focus.delete) k values
808-
when gotIt $
809-
modifyTVar' dk (HSet.insert k)
810-
return $ if gotIt then (counter+1, k:keys) else st
807+
= atomically $ do
808+
gotIt <- STM.focus (Focus.member <* Focus.delete) k values
809+
when gotIt $
810+
modifyTVar' dk (HSet.insert k)
811+
return $ if gotIt then (counter+1, k:keys) else st
811812
| otherwise = pure st
812813

813814
countRelevantKeys :: CheckParents -> [Key] -> Int

0 commit comments

Comments
 (0)