Skip to content

Commit

Permalink
fix: remove redundant message in streaming (#739)
Browse files Browse the repository at this point in the history
Because

- There is a redundant `null` message at the end of streaming.

This commit

- Removes redundant message in streaming
  • Loading branch information
donch1989 authored Oct 15, 2024
1 parent 3300471 commit 50ce029
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/handler/triggerhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ func HandleTrigger(mux *runtime.ServeMux, client pb.PipelinePublicServiceClient,
return
}
}
// When using `streamHandler`, we should directly close the response once
// the event stream is completed to prevent redundant events.
if sh != nil {
return
}

annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)

Expand Down Expand Up @@ -594,6 +599,11 @@ func HandleTriggerRelease(mux *runtime.ServeMux, client pb.PipelinePublicService
return
}
}
// When using `streamHandler`, we should directly close the response once
// the event stream is completed to prevent redundant events.
if sh != nil {
return
}

annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)

Expand Down

0 comments on commit 50ce029

Please sign in to comment.