File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
pkg/cloudevents/server/grpc Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,6 @@ func (bkr *GRPCBroker) Subscribe(subReq *pbv1.SubscriptionRequest, subServer pbv
217217 // WARNING: don't use "pbEvt, err := pb.ToProto(evt)" to convert cloudevent to protobuf
218218 pbEvt := & pbv1.CloudEvent {}
219219 if err := grpcprotocol .WritePBMessage (context .TODO (), binding .ToMessage (evt ), pbEvt ); err != nil {
220- // return the error to requeue the event if converting to protobuf fails (e.g., due to invalid cloudevent).
221220 return fmt .Errorf ("failed to convert cloudevent to protobuf for resource(%s): %v" , evt .ID (), err )
222221 }
223222
@@ -226,7 +225,12 @@ func (bkr *GRPCBroker) Subscribe(subReq *pbv1.SubscriptionRequest, subServer pbv
226225 select {
227226 case eventCh <- pbEvt :
228227 case <- ctx .Done ():
229- return status .Error (codes .Unavailable , "stream context canceled" )
228+ // The context of the stream has been canceled or completed.
229+ // This could happen if:
230+ // - The client closed the connection or canceled the stream.
231+ // - The server closed the stream, potentially due to a shutdown.
232+ // No error is returned here because the stream closure is expected.
233+ return nil
230234 }
231235
232236 return nil
You can’t perform that action at this time.
0 commit comments