Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Run strategy discovery in parallel #93

Merged
merged 1 commit into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/App/Fossa/Analyze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ renderFailure failure = object
]

discover :: HasDiscover sig m => Path Abs Dir -> m ()
discover dir = traverse_ ($ dir) discoverFuncs
discover dir = traverse_ (forkTask . apply dir) discoverFuncs

discoverWithArchives :: HasDiscover sig m => Path Abs Dir -> m ()
discoverWithArchives dir = traverse_ ($ dir) (Archive.discover discoverWithArchives : discoverFuncs)
discoverWithArchives dir = traverse_ (forkTask . apply dir) (Archive.discover discoverWithArchives : discoverFuncs)

apply :: a -> (a -> b) -> b
apply x f = f x

discoverFuncs :: HasDiscover sig m => [Path Abs Dir -> m ()]
discoverFuncs =
Expand Down
5 changes: 4 additions & 1 deletion src/App/Pathfinder/Scan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ scan basedir = runFinally $ do
capabilities <- liftIO getNumCapabilities

(closures,(_,())) <- runOutput @ProjectClosure $ runOutput @ProjectFailure $
withTaskPool capabilities updateProgress (traverse_ ($ basedir) discoverFuncs)
withTaskPool capabilities updateProgress (traverse_ (forkTask . apply basedir) discoverFuncs)

logSticky "[ Combining Analyses ]"

Expand All @@ -54,6 +54,9 @@ scan basedir = runFinally $ do

logSticky ""

apply :: a -> (a -> b) -> b
apply x f = f x

discoverFuncs :: HasDiscover sig m => [Path Abs Dir -> m ()]
discoverFuncs =
[ Nuspec.discover
Expand Down