-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚡ discover assets in parallel (#4973)
This change use the new `workerpool` package to discover assets in parallel. There were a few places that I detected race conditions that I have fixed, I also added a race detector `make` command which is running as a CI job. For testing: Using the `github` provider for testing, scanning an **organization that has around 3k repositories**. **Before (~15 Minutes)** ``` TRC logger.FuncDur> func=explorer.discoverAssets took=890303.455042 ``` **After (~2 minutes)** ``` TRC logger.FuncDur> func=explorer.discoverAssets took=124293.542166 ``` Race Detector: You can now run `make race/go` to check for race conditions. ``` $ make race/go go test -race go.mondoo.com/cnquery/v11/internal/workerpool ok go.mondoo.com/cnquery/v11/internal/workerpool 16.417s go test -race go.mondoo.com/cnquery/v11/explorer/scan ok go.mondoo.com/cnquery/v11/explorer/scan 2.487s ``` Additional commit history: * ⚡ workerpool package to submit parallel requests * ⚡ fetch org repositories in parallel * ⚙️ add a collector to the workerpool * 🚨 fix race conditions * ⚡ discover assets in parallel * 🧪 decrease workerpool wait ticker to 10ms * 🐛 make `DiscoveredAssets.AddError()` thread safe * 🧵 add mutex when running `provider.connect()` * ⚙️ reduce the workerpool Task function * ⚙️ return `pool.Result` as a combined struct * 🏎️ fix more data race conditions * 🤖 Run race detector on CI * ⚙️ split plugin connect func and assignation --------- Signed-off-by: Salim Afiune Maya <[email protected]>
- Loading branch information
Showing
13 changed files
with
212 additions
and
102 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,6 +198,18 @@ | |
"shell", "ssh", "[email protected]", | ||
], | ||
}, | ||
{ | ||
"name": "scan github org", | ||
"type": "go", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/apps/cnquery/cnquery.go", | ||
"args": [ | ||
"scan", | ||
"github", | ||
"org", "hit-training", | ||
"--log-level", "trace" | ||
] | ||
}, | ||
{ | ||
"name": "Configure Built-in Providers", | ||
"type": "go", | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.