Created
August 28, 2018 08:31
-
-
Save lorenzo/a2bfa0be4ea78f82034732537b212df0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sitesQuery :: Query | |
sitesQuery = "select id, name from sites" | |
queryUsersAndCreateCheckpoints :: IO () | |
queryUsersAndCreateCheckpoints = do | |
conn <- mysqlConnect -- my own helper function | |
statement <- prepareStmt conn sitesQuery | |
results <- | |
queryStmtResults conn statement [] >>= -- Query all the sites so they can be processed concurrently | |
Streams.toList -- The list is small, so we need no streaming | |
closeStmt conn statement | |
close conn | |
files <- mapConcurrently processSingleSite results | |
... | |
processSingleSite :: (Int, Text) -> IO (Maybe Text) | |
processSingleSite siteId, siteName) = do | |
putStrLn ("Processing site: " ++ siteName) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment