Fix the bad use of async
Propagate errors with `mapConcurrently_`
This commit is contained in:
@@ -18,7 +18,7 @@ import Control.Concurrent.STM (atomically, dupTChan, readTChan)
|
||||
import Data.Aeson (Value)
|
||||
import qualified Data.Text as T
|
||||
import Data.Time (getCurrentTime, getCurrentTimeZone)
|
||||
import Data.Void (Void, absurd)
|
||||
import Data.Void (Void)
|
||||
import HomeAssistant.Controller (HASS, HASSEff (..))
|
||||
import HomeAssistant.Runtime.Bus
|
||||
import HomeAssistant.Runtime.Connection (writerAction, readerAction)
|
||||
@@ -116,10 +116,8 @@ defaultMain = withSocketsDo $ do
|
||||
, ("metrics", HomeAssistant.Runtime.Metrics.metricsAction store rrdPath rrdtool)
|
||||
, ("metrics-http", HomeAssistant.Runtime.Graphing.graphAction rrdPath rrdtool metricsPort)
|
||||
] ++ [ (name, runController rootPath bus c) | c@(Controller name _ True) <- controllers ]
|
||||
as <- runKatipContextT (busLogEnv bus) () mempty $
|
||||
mapM (\(name, act) -> async (supervised name act)) workers
|
||||
(_, v) <- waitAny as
|
||||
absurd v
|
||||
runKatipContextT (busLogEnv bus) () mempty $
|
||||
mapConcurrently_ (uncurry supervised) workers
|
||||
|
||||
dryRunHassEval :: Namespace -> Bus -> HASSEff a -> IO a
|
||||
dryRunHassEval ns bus = \case
|
||||
|
||||
Reference in New Issue
Block a user