Skip to content

Commit

Permalink
Merge branch 'main' into i546/handle-independent-stages
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Dec 13, 2022
2 parents d0e39e5 + f8dd7de commit 50a7db0
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions cmd/vela-worker/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package main

import (
"context"
"sync"
"time"

"github.com/go-vela/worker/executor"
Expand Down Expand Up @@ -110,13 +109,7 @@ func (w *Worker) exec(index int) error {
timeoutCtx, timeout := context.WithTimeout(buildCtx, t)
defer timeout()

// This WaitGroup delays calling DestroyBuild until the StreamBuild goroutine finishes.
var wg sync.WaitGroup

defer func() {
// if exec() exits before starting StreamBuild, this returns immediately.
wg.Wait()

logger.Info("destroying build")

// destroy the build with the executor (pass a background
Expand Down Expand Up @@ -145,12 +138,8 @@ func (w *Worker) exec(index int) error {
return nil
}

// add StreamBuild goroutine to WaitGroup
wg.Add(1)

// log/event streaming uses buildCtx so that it is not subject to the timeout.
go func() {
defer wg.Done()
logger.Info("streaming build logs")
// execute the build with the executor
err = _executor.StreamBuild(buildCtx)
Expand Down

0 comments on commit 50a7db0

Please sign in to comment.