@@ -325,9 +325,7 @@ func (e *executor) plan(ctx, killCtx context.Context, env, vars []string, logr l
325325 <- doneErr
326326 }()
327327
328- endStage := e .timings .startStage (database .ProvisionerJobTimingStagePlan )
329328 err := e .execWriteOutput (ctx , killCtx , args , env , outWriter , errWriter )
330- endStage (err )
331329 if err != nil {
332330 return nil , xerrors .Errorf ("terraform plan: %w" , err )
333331 }
@@ -386,13 +384,11 @@ func (e *executor) plan(ctx, killCtx context.Context, env, vars []string, logr l
386384 }
387385 }
388386
389- // DoneOut must be completed before we aggregate timings to ensure all logs have been processed.
390- <- doneOut
391387 msg := & proto.PlanComplete {
392388 Parameters : state .Parameters ,
393389 Resources : state .Resources ,
394390 ExternalAuthProviders : state .ExternalAuthProviders ,
395- Timings : append ( e . timings . aggregate (), graphTimings .aggregate () ... ),
391+ Timings : graphTimings .aggregate (),
396392 Presets : state .Presets ,
397393 Plan : planJSON ,
398394 ResourceReplacements : resReps ,
@@ -601,9 +597,7 @@ func (e *executor) apply(
601597 }()
602598
603599 // `terraform apply`
604- endStage := e .timings .startStage (database .ProvisionerJobTimingStageApply )
605600 err := e .execWriteOutput (ctx , killCtx , args , env , outWriter , errWriter )
606- endStage (err )
607601 if err != nil {
608602 return nil , xerrors .Errorf ("terraform apply: %w" , err )
609603 }
@@ -619,15 +613,11 @@ func (e *executor) apply(
619613 return nil , xerrors .Errorf ("read statefile %q: %w" , statefilePath , err )
620614 }
621615
622- // DoneOut must be completed before we aggregate timings to ensure all logs have been processed.
623- <- doneOut
624- agg := e .timings .aggregate ()
625616 return & proto.ApplyComplete {
626617 Parameters : state .Parameters ,
627618 Resources : state .Resources ,
628619 ExternalAuthProviders : state .ExternalAuthProviders ,
629620 State : stateContent ,
630- Timings : agg ,
631621 AiTasks : state .AITasks ,
632622 }, nil
633623}
0 commit comments