File tree 1 file changed +5
-5
lines changed
ghcide/src/Development/IDE/Core
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import Control.Concurrent.Async
12
12
import Control.Concurrent.STM
13
13
import Control.Concurrent.STM.Stats (atomicallyNamed )
14
14
import Control.Exception
15
- import Control.Monad (join )
15
+ import Control.Monad (join , void )
16
16
import Data.Hashable
17
17
import GHC.Conc (unsafeIOToSTM )
18
18
import qualified StmContainers.Map as STM
@@ -40,15 +40,15 @@ asyncRegisterEvent d delay k fire = join $ atomically $ do
40
40
prev <- STM. lookup k d
41
41
case prev of
42
42
Just v -> writeTVar v (delay, fire) >> return (pure () )
43
- Nothing -> return $ do
44
- var <- newTVarIO (delay, fire)
45
- _ <- async $ do
43
+ Nothing -> do
44
+ var <- newTVar (delay, fire)
45
+ STM. insert var k d
46
+ return $ void $ async $ do
46
47
join $ atomicallyNamed " debouncer - sleep" $ do
47
48
(s,act) <- readTVar var
48
49
unsafeIOToSTM $ sleep s
49
50
STM. delete k d
50
51
return act
51
- atomicallyNamed " debouncer2" $ STM. insert var k d
52
52
53
53
-- | Debouncer used in the DAML CLI compiler that emits events immediately.
54
54
noopDebouncer :: Debouncer k
You can’t perform that action at this time.
0 commit comments