fix: make a new ctx when start scan all in async

Signed-off-by: He Weiwei <hweiwei@vmware.com>
This commit is contained in:
He Weiwei 2021-01-27 08:44:39 +00:00 committed by Ziming
parent 30a89f2368
commit 3ba0d5a590

View File

@ -286,7 +286,7 @@ func (bc *basicController) ScanAll(ctx context.Context, trigger string, async bo
}
if async {
go func() {
go func(ctx context.Context) {
// if async, this is running in another goroutine ensure the execution exists in db
err := lib.RetryUntil(func() error {
_, err := bc.execMgr.Get(ctx, executionID)
@ -297,8 +297,8 @@ func (bc *basicController) ScanAll(ctx context.Context, trigger string, async bo
return
}
bc.startScanAll(bc.makeCtx(), executionID)
}()
bc.startScanAll(ctx, executionID)
}(bc.makeCtx())
} else {
if err := bc.startScanAll(ctx, executionID); err != nil {
return 0, err