Skip to content

Commit 6b44280

Browse files
committed
fix skipped actions
1 parent 8396a37 commit 6b44280

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

hls-graph/src/Development/IDE/Graph/Database.hs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@ shakeRunDatabaseForKeysSep
8888
-> [Action a]
8989
-> Bool
9090
-> IO (IO [Either SomeException a])
91-
shakeRunDatabaseForKeysSep keysChanged (ShakeDatabase _ as1 db) acts isTesting = do
92-
let runOne d = do
93-
getAction d
94-
liftIO $ atomically $ doneQueue d (databaseActionQueue db)
95-
91+
shakeRunDatabaseForKeysSep keysChanged sdb@(ShakeDatabase _ as1 db) acts isTesting = do
9692
-- we can to upsweep these keys in order one by one,
9793
preserves <- incDatabase1 db keysChanged
9894
(_, act) <- instantiateDelayedAction (mkDelayedAction "upsweep" Debug $ upsweepAction)
@@ -101,9 +97,9 @@ shakeRunDatabaseForKeysSep keysChanged (ShakeDatabase _ as1 db) acts isTesting =
10197
if isTesting
10298
then return $ reenqueued
10399
else return $ filter (\d -> (newDirectKey $ fromJust $ hashUnique <$> uniqueID d) `notMemberKeySet` preserves) reenqueued
104-
let ignoreResultActs = (getAction act) : (liftIO $ prepareToRunKeysRealTime db) : as1 ++ map runOne reenqueuedExceptPreserves
100+
let ignoreResultActs = (getAction act) : (liftIO $ prepareToRunKeysRealTime db) : as1
105101
return $ do
106-
-- prepareToRunKeys db upsweepKeys
102+
seqRunActions (newKey "root") db $ map (pumpActionThreadReRun sdb) reenqueuedExceptPreserves
107103
drop (length ignoreResultActs) <$> runActions (newKey "root") db (map unvoid ignoreResultActs ++ acts)
108104

109105
instantiateDelayedAction

hls-graph/src/Development/IDE/Graph/Internal/Action.hs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ module Development.IDE.Graph.Internal.Action
1515
, getKeysAndVisitedAge
1616
, isAsyncException
1717
, pumpActionThread
18+
, pumpActionThreadReRun
19+
, sequenceRun
20+
, seqRunActions
1821
) where
1922

2023
import Control.Concurrent.Async
2124
import Control.Concurrent.STM.Stats (atomicallyNamed)
2225
import Control.DeepSeq (force)
2326
import Control.Exception
27+
import Control.Monad (void)
2428
import Control.Monad.IO.Class
2529
import Control.Monad.RWS (MonadReader (ask),
2630
asks)
@@ -77,6 +81,20 @@ parallel xs = do
7781
-- getAction d
7882
-- liftIO $ atomically $ doneQueue d actionQueue
7983

84+
-- pumpActionThread1 :: ShakeDatabase -> Action ()
85+
pumpActionThreadReRun :: ShakeDatabase -> DelayedAction () -> Action ()
86+
pumpActionThreadReRun (ShakeDatabase _ _ db) d = do
87+
a <- ask
88+
s <- atomically $ getDataBaseStepInt db
89+
liftIO $ runInThreadStmInNewThreads db
90+
(return $ DeliverStatus s (actionName d) key)
91+
(ignoreState a $ runOne d) (const $ return ())
92+
where
93+
key = (newDirectKey $ fromJust $ hashUnique <$> uniqueID d)
94+
runOne d = setActionKey key $ do
95+
_ <- getAction d
96+
liftIO $ atomically $ doneQueue d (databaseActionQueue db)
97+
8098
pumpActionThread :: ShakeDatabase -> (String -> IO ()) -> Action b
8199
pumpActionThread sdb@(ShakeDatabase _ _ db) logMsg = do
82100
do
@@ -177,7 +195,18 @@ runActions pk db xs = do
177195
deps <- newIORef mempty
178196
runActionMonad (parallel xs) $ SAction pk db deps emptyStack
179197

180-
-- | Returns the set of dirty keys annotated with their age (in # of builds)
198+
seqRunActions :: Key -> Database -> [Action a] -> IO ()
199+
seqRunActions pk db xs = do
200+
deps <- newIORef mempty
201+
runActionMonad (sequenceRun xs) $ SAction pk db deps emptyStack
202+
203+
sequenceRun :: [Action a] -> Action ()
204+
sequenceRun [] = return ()
205+
sequenceRun (x:xs) = do
206+
void x
207+
sequenceRun xs
208+
209+
-- | Returns the set of dirty keys annotated with their age
181210
getDirtySet :: Action [(Key, Int)]
182211
getDirtySet = do
183212
db <- getDatabase

0 commit comments

Comments
 (0)