Merge pull request #14875 from heww/fix-scan-all

fix: using new ctx to scan artifact when scanAll
This commit is contained in:
Daniel Jiang 2021-05-14 12:56:10 +08:00 committed by GitHub
commit 35c9a98272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -327,7 +327,7 @@ func (bc *basicController) startScanAll(ctx context.Context, executionID int64)
return bc.Scan(ctx, artifact, WithExecutionID(executionID))
}
if err := orm.WithTransaction(scan)(ctx); err != nil {
if err := orm.WithTransaction(scan)(bc.makeCtx()); err != nil {
// Just logged
log.Errorf("failed to scan artifact %s, error %v", artifact, err)

View File

@ -278,7 +278,7 @@ func (suite *ControllerTestSuite) SetupSuite() {
},
cloneCtx: func(ctx context.Context) context.Context { return ctx },
makeCtx: func() context.Context { return context.TODO() },
makeCtx: func() context.Context { return orm.NewContext(nil, &ormtesting.FakeOrmer{}) },
execMgr: suite.execMgr,
taskMgr: suite.taskMgr,