From 55cd938ef7c97eaf0008f83d51668bbf12dc77d8 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 12 Dec 2023 03:26:13 +0100 Subject: chore: add parallelism to `getHistory` --- app/History.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/History.hs') diff --git a/app/History.hs b/app/History.hs index 3ac8a8e..ed07bcd 100644 --- a/app/History.hs +++ b/app/History.hs @@ -4,6 +4,7 @@ module History ) where +import Parallel (parMapM, parSequence) import CMark qualified as D import Cache (cachedMaybe) import Comment qualified as G @@ -106,7 +107,7 @@ getIssuesAndFilesChanged commitHash = do issues <- concat <$> catch - (mapM (getIssues commitHash) files) + (parMapM (getIssues commitHash) files) (\(e :: E.InvalidTreeGrepperResult) -> die (show e)) pure (issues, files) @@ -114,7 +115,7 @@ getIssuesAndFilesChanged commitHash = do getIssues :: CommitHash -> FilePath -> IO [I.Issue] getIssues commitHash filename = handle (\(_ :: E.UnknownFileExtension) -> pure []) $ - fmap catMaybes . mapM (fromComment commitHash) + fmap catMaybes . parMapM (fromComment commitHash) =<< G.getComments commitHash filename -- | Note that `provenance` is trivial and needs to be fixed up later. @@ -187,7 +188,7 @@ propagateIssueEvents oldIssueEvents oldIssues commitHash issues = newIssueEvents :: M.Map T.Text I.Issue -> CommitHash -> M.Map T.Text I.Issue -> IO [IssueEvent] newIssueEvents oldIssues' commitHash issues' = - sequence $ + parSequence $ concat [ [ IssueCreated commitHash issue <$> patchCreated issue | issue <- M.elems (issues `M.difference` oldIssues) -- cgit v1.2.3