Skip to content

Commit

Permalink
Timeout handler : WaitTaskRun only if the pod got created successfully
Browse files Browse the repository at this point in the history
We can save one goroutines per pod creation by waiting for TaskRun
only if the pod creation was successful.

Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester authored and tekton-robot committed Mar 25, 2019
1 parent c6a1013 commit 2f9a998
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/reconciler/v1alpha1/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error
}
} else {
// Pod is not present, create pod.
go c.timeoutHandler.WaitTaskRun(tr)
pod, err = c.createBuildPod(tr, rtr.TaskSpec, rtr.TaskName)
if err != nil {
// This Run has failed, so we need to mark it as failed and stop reconciling it
Expand All @@ -314,6 +313,7 @@ func (c *Reconciler) reconcile(ctx context.Context, tr *v1alpha1.TaskRun) error
c.Logger.Errorf("Failed to create build pod for task %q :%v", err, tr.Name)
return nil
}
go c.timeoutHandler.WaitTaskRun(tr)
}
if err := c.tracker.Track(tr.GetBuildPodRef(), tr); err != nil {
c.Logger.Errorf("Failed to create tracker for build pod %q for taskrun %q: %v", tr.Name, tr.Name, err)
Expand Down

0 comments on commit 2f9a998

Please sign in to comment.