Skip to content

Commit bee6934

Browse files
committed
fix race condition
1 parent 336231e commit bee6934

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

provisioner/terraform/executor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ func (e *executor) plan(ctx, killCtx context.Context, env, vars []string, logr l
373373
return nil, xerrors.Errorf("convert plan state: %w", err)
374374
}
375375

376+
// DoneOut must be completed before we aggregate timings to ensure all logs have been processed.
377+
<-doneOut
376378
msg := &proto.PlanComplete{
377379
Timings: e.timings.aggregate(),
378380
Plan: planJSON,
@@ -559,6 +561,8 @@ func (e *executor) apply(
559561
return nil, xerrors.Errorf("read statefile %q: %w", statefilePath, err)
560562
}
561563

564+
// DoneOut must be completed before we aggregate timings to ensure all logs have been processed.
565+
<-doneOut
562566
agg := e.timings.aggregate()
563567
return &proto.ApplyComplete{
564568
State: stateContent,

0 commit comments

Comments
 (0)