diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-12-12 03:26:13 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-12-12 04:00:24 +0100 |
commit | 55cd938ef7c97eaf0008f83d51668bbf12dc77d8 (patch) | |
tree | 96a543410abdeb8508cab013ce2a77a87c08a8cd /app/History.hs | |
parent | a1cfb7e1078e07af80de617689bb1c1e6a65ec46 (diff) |
chore: add parallelism to `getHistory`
Diffstat (limited to 'app/History.hs')
-rw-r--r-- | app/History.hs | 7 |
1 files changed, 4 insertions, 3 deletions
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) |