Skip to content

Commit

Permalink
Make sure gRPC connection is closed
Browse files Browse the repository at this point in the history
In the error case the gRPC stream is closed. By using a new context and
cancelling it when the function is finished we should guarentee that the
gRPC context is closed.

Fixes #624
  • Loading branch information
stuartwdouglas authored and tekton-robot committed Oct 4, 2023
1 parent d93166e commit 0aa7ce4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/watcher/reconciler/dynamic/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ func (r *Reconciler) sendLog(ctx context.Context, o results.Object) error {

func (r *Reconciler) streamLogs(ctx context.Context, o results.Object, logType, logName string) error {
logger := logging.FromContext(ctx)
ctx, cancel := context.WithCancel(ctx)
defer cancel()
logsClient, err := r.resultsClient.UpdateLog(ctx)
if err != nil {
return fmt.Errorf("failed to create UpdateLog client: %v", err)
Expand Down

0 comments on commit 0aa7ce4

Please sign in to comment.