From 92618ef3a9b7693db0fb52bd72becbed28596c22 Mon Sep 17 00:00:00 2001 From: Charlie Moog Date: Sun, 26 May 2024 04:48:57 +0000 Subject: [PATCH] fetch stores concurrently --- Main.hs | 3 ++- traderjoes.cabal | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Main.hs b/Main.hs index fedafb0..fee63d3 100644 --- a/Main.hs +++ b/Main.hs @@ -1,5 +1,6 @@ module Main where +import Control.Concurrent.Async (mapConcurrently_) import Control.Monad import Data.ByteString.Lazy (ByteString) import Data.ByteString.Lazy qualified as L @@ -53,7 +54,7 @@ handleArgs ["fetch"] = do , "546" -- NYC East Village , "452" -- Austin Seaholm ] - mapM_ (scrapeStore conn) stores + mapConcurrently_ (scrapeStore conn) stores printlog "done" changeCount <- SQL.totalChanges conn printlog $ "changed rows: " <> show changeCount diff --git a/traderjoes.cabal b/traderjoes.cabal index 9691671..958440c 100644 --- a/traderjoes.cabal +++ b/traderjoes.cabal @@ -12,6 +12,7 @@ executable traderjoes ghc-options: -Wall -Werror build-depends: base , aeson + , async , blaze-html , blaze-markup , bytestring