Skip to content

Commit

Permalink
IngestPackages: dedicated ctx from errgroup.WithContext
Browse files Browse the repository at this point in the history
Signed-off-by: mrizzi <[email protected]>
  • Loading branch information
mrizzi committed Nov 8, 2023
1 parent 21f2e29 commit cc57b06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/assembler/backends/ent/backend/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ func (b *EntBackend) Packages(ctx context.Context, pkgSpec *model.PkgSpec) ([]*m
func (b *EntBackend) IngestPackages(ctx context.Context, pkgs []*model.PkgInputSpec) ([]*model.Package, error) {
// FIXME: (ivanvanderbyl) This will be suboptimal because we can't batch insert relations with upserts. See Readme.
models := make([]*model.Package, len(pkgs))
eg, ctx := errgroup.WithContext(ctx)
eg, egCtx := errgroup.WithContext(ctx)
for i := range pkgs {
index := i
pkg := pkgs[index]
concurrently(eg, func() error {
p, err := b.IngestPackage(ctx, *pkg)
p, err := b.IngestPackage(egCtx, *pkg)
if err == nil {
models[index] = p
}
Expand Down

0 comments on commit cc57b06

Please sign in to comment.