Process logs in parallel

This commit is contained in:
Andrew Ayer 2019-12-02 15:19:35 -05:00
parent c2099d6d49
commit 86785d89d7
1 changed files with 9 additions and 2 deletions

View File

@ -328,9 +328,16 @@ func Main(statePath string, processCallback certspotter.ProcessCallback) int {
return 1 return 1
} }
exitCode := 0 processLogResults := make(chan int)
for i := range logs { for i := range logs {
exitCode |= processLog(&logs[i], processCallback) go func(logInfo *certspotter.LogInfo) {
processLogResults <- processLog(logInfo, processCallback)
}(&logs[i])
}
exitCode := 0
for range logs {
exitCode |= <-processLogResults
} }
if state.IsFirstRun() && exitCode == 0 { if state.IsFirstRun() && exitCode == 0 {