fix: restore behaviour of waiting asynchronously for job-management
This commit is contained in:
parent
cc7a5289a4
commit
5ebcd89e11
@ -55,6 +55,8 @@ import Data.Time.Zones
|
||||
import Control.Concurrent.STM (retry)
|
||||
import Control.Concurrent.STM.Delay
|
||||
|
||||
import UnliftIO.Concurrent (forkIO)
|
||||
|
||||
|
||||
import Jobs.Handler.SendNotification
|
||||
import Jobs.Handler.SendTestEmail
|
||||
@ -219,7 +221,7 @@ stopJobCtl UniWorX{appJobState} = do
|
||||
didStop <- atomically $ do
|
||||
jState <- tryReadTMVar appJobState
|
||||
for jState $ \jSt'@JobState{jobShutdown} -> jSt' <$ tryPutTMVar jobShutdown ()
|
||||
whenIsJust didStop $ \jSt' -> void . atomically $ do
|
||||
whenIsJust didStop $ \jSt' -> void . forkIO . atomically $ do
|
||||
workers <- maybe [] (Map.keys . jobWorkers) <$> tryTakeTMVar appJobState
|
||||
mapM_ (void . waitCatchSTM) $
|
||||
[ jobPoolManager jSt'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user