Skip to content

Commit f9ef65a

Browse files
committed
add shutdown log
1 parent a3c86b0 commit f9ef65a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ data Log
198198
-- * OfInterest Log messages
199199
| LogSetFilesOfInterest ![(NormalizedFilePath, FileOfInterestStatus)]
200200
| LogTimeOutShuttingDownWaitForSessionVar !Seconds
201+
| LogShakeShutProcess !ShutStage
202+
deriving Show
203+
data ShutStage = ShutSessionCanceled | ShutProfiledDone | ShutProgressMonitorStop | ShutProgressStop | ShutSessionGet
201204
deriving Show
202205

203206
instance Pretty Log where
@@ -242,7 +245,7 @@ instance Pretty Log where
242245
"Set files of interst to" <> Pretty.line
243246
<> indent 4 (pretty $ fmap (first fromNormalizedFilePath) ofInterest)
244247
LogTimeOutShuttingDownWaitForSessionVar seconds ->
245-
"Timed out waiting for session var after" <+> pretty seconds <+> "seconds"
248+
"ShutWaitFor session timed out waiting for session var after" <+> pretty seconds <+> "seconds"
246249

247250
-- | We need to serialize writes to the database, so we send any function that
248251
-- needs to write to the database over the channel, where it will be picked up by
@@ -732,15 +735,19 @@ shakeShut recorder IdeState{..} = do
732735
res <- timeout 1 $ withMVar shakeSession $ \runner -> do
733736
-- Shake gets unhappy if you try to close when there is a running
734737
-- request so we first abort that.
738+
logWith recorder Warning $ LogShakeShutProcess ShutSessionGet
735739
cancelShakeSession runner
740+
logWith recorder Warning $ LogShakeShutProcess ShutSessionCanceled
736741
void $ shakeDatabaseProfile shakeDb
742+
logWith recorder Warning $ LogShakeShutProcess ShutProfiledDone
737743
-- might hang if there are still running
738744
progressStop $ progress shakeExtras
745+
logWith recorder Warning $ LogShakeShutProcess ShutProgressStop
739746
stopMonitoring
747+
logWith recorder Warning $ LogShakeShutProcess ShutProgressMonitorStop
740748
case res of
741-
Nothing -> do
749+
Nothing ->
742750
logWith recorder Error $ LogTimeOutShuttingDownWaitForSessionVar 1
743-
stopMonitoring
744751
Just _ -> pure ()
745752

746753
-- | This is a variant of withMVar where the first argument is run unmasked and if it throws

0 commit comments

Comments
 (0)