projects
/
lsp-test.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add notice that this was merged into haskell/lsp
[lsp-test.git]
/
src
/
Language
/
LSP
/
Test
/
Parsing.hs
diff --git
a/src/Language/LSP/Test/Parsing.hs
b/src/Language/LSP/Test/Parsing.hs
index b5221168dff1ba2bf6d2f55fecb96fa99c3b3935..247f969862f2ad25a42ad3dc10e6de4802509201 100644
(file)
--- a/
src/Language/LSP/Test/Parsing.hs
+++ b/
src/Language/LSP/Test/Parsing.hs
@@
-83,16
+83,21
@@
satisfyMaybeM pred = do
skipTimeout <- overridingTimeout <$> get
timeoutId <- getCurTimeoutId
skipTimeout <- overridingTimeout <$> get
timeoutId <- getCurTimeoutId
- unless skipTimeout $ do
+ mtid <-
+ if skipTimeout
+ then pure Nothing
+ else Just <$> do
chan <- asks messageChan
timeout <- asks (messageTimeout . config)
chan <- asks messageChan
timeout <- asks (messageTimeout . config)
-
void $
liftIO $ forkIO $ do
+
liftIO $ forkIO $ do
threadDelay (timeout * 1000000)
writeChan chan (TimeoutMessage timeoutId)
x <- Session await
threadDelay (timeout * 1000000)
writeChan chan (TimeoutMessage timeoutId)
x <- Session await
- unless skipTimeout (bumpTimeoutId timeoutId)
+ forM_ mtid $ \tid -> do
+ bumpTimeoutId timeoutId
+ liftIO $ killThread tid
modify $ \s -> s { lastReceivedMessage = Just x }
modify $ \s -> s { lastReceivedMessage = Just x }