-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1065 from titanventura/concurrent-resource-fetchi…
…ng-per-provider feat: concurrent resource fetching per provider
- Loading branch information
Showing
4 changed files
with
126 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package internal | ||
|
||
import ( | ||
"context" | ||
"io" | ||
"testing" | ||
|
||
log "github.com/sirupsen/logrus" | ||
|
||
"github.com/tailwarden/komiser/internal/config" | ||
"github.com/tailwarden/komiser/utils" | ||
) | ||
|
||
// BenchmarkFactorial benchmarks the Factorial function. | ||
func BenchmarkFetchResources(b *testing.B) { | ||
// Setup | ||
ctx := context.TODO() | ||
log.SetOutput(io.Discard) | ||
analytics.Init() | ||
cfg, clients, accounts, err := config.Load("/workspaces/komiser/config.toml", false, analytics, db) | ||
if err != nil { | ||
b.Fatalf("Error during config setup: %v", err) | ||
} | ||
err = setupDBConnection(cfg) | ||
if err != nil { | ||
b.Fatalf("Error during DB setup: %v", err) | ||
} | ||
err = utils.SetupSchema(db, cfg, accounts) | ||
if err != nil { | ||
b.Fatalf("Error during schema setup: %v", err) | ||
} | ||
|
||
// The benchmark function will run b.N times | ||
for i := 0; i < b.N; i++ { | ||
fetchResources(ctx, clients, []string{}, false) | ||
} | ||
} |
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