fix: scheduler nonsense

This commit is contained in:
orion 2024-05-03 13:55:16 -05:00
parent ebf048b431
commit 559967d7a7
Signed by: orion
GPG Key ID: 6D4165AE4C928719

View File

@ -19,10 +19,11 @@ import Data.Foldable (for_)
import Data.Map (Map) import Data.Map (Map)
import Data.Map as Map import Data.Map as Map
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Newtype (wrap)
import Data.Nullable (Nullable) import Data.Nullable (Nullable)
import Data.Nullable as Nullable import Data.Nullable as Nullable
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Canceler(..), launchAff_, makeAff) import Effect.Aff (Canceler(..), delay, launchAff_, makeAff)
import Effect.Aff.Class (class MonadAff, liftAff) import Effect.Aff.Class (class MonadAff, liftAff)
import Effect.Aff.Unlift (class MonadUnliftAff, UnliftAff(..), askUnliftAff) import Effect.Aff.Unlift (class MonadUnliftAff, UnliftAff(..), askUnliftAff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
@ -117,7 +118,7 @@ foreach
foreach stream cb = do foreach stream cb = do
UnliftAff unlift <- askUnliftAff UnliftAff unlift <- askUnliftAff
liftAff $ makeAff \res -> do liftAff $ makeAff \res -> do
removeDataListener <- flip (Event.on dataH) stream \row -> do removeDataListener <- flip (Event.on dataH) stream \row -> launchAff_ $ delay (wrap 0.0) <* liftEffect do
cols <- getOrInitColumnsMap stream cols <- getOrInitColumnsMap stream
for_ cols \cols' -> do for_ cols \cols' -> do
record <- liftEither $ lmap (error <<< show) $ runExcept $ readCSVRecord @r @rl cols' row record <- liftEither $ lmap (error <<< show) $ runExcept $ readCSVRecord @r @rl cols' row