Skip to content

Commit

Permalink
return nil when its the end of a stream (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
asim authored Jun 22, 2021
1 parent 4503b2e commit 6223c2b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion v1api/handler/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"bytes"
"context"
"encoding/json"
"io"
"strings"
"sync"

Expand Down Expand Up @@ -111,10 +112,14 @@ func serveStream(ctx context.Context, stream server.Stream, service, endpoint st
// read backend response body
buf, err := rsp.Read()
if err != nil {
// wants to avoid import grpc/status.Status
// wants to avoid import grpc/status.Status
if strings.Contains(err.Error(), "context canceled") {
return nil
}
// end of stream
if err == io.EOF {
return nil
}
logger.Error(err)
return errInternal
}
Expand Down

0 comments on commit 6223c2b

Please sign in to comment.