mirror of https://github.com/milvus-io/milvus.git
fix: [2.5][RESTFUL] Return error when writer body closed (#41184)
Cherry-pick from master pr: #41183 Related to #41181 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/41221/head
parent
77e6404617
commit
7001474914
|
@ -25,6 +25,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/cockroachdb/errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
mhttp "github.com/milvus-io/milvus/internal/http"
|
||||
|
@ -81,7 +82,7 @@ func NewWriter(w gin.ResponseWriter, buf *bytes.Buffer) *Writer {
|
|||
// Write will write data to response body
|
||||
func (w *Writer) Write(data []byte) (int, error) {
|
||||
if w.timeout || w.body == nil {
|
||||
return 0, nil
|
||||
return 0, errors.New("Response writer closed")
|
||||
}
|
||||
|
||||
w.mu.Lock()
|
||||
|
|
Loading…
Reference in New Issue