mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 10:08:42 +08:00
fix: [RESTFUL] Return error when writer body closed (#41183)
Related to #41181 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
0d45b24599
commit
b593bfd9a5
@ -25,6 +25,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/cockroachdb/errors"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
mhttp "github.com/milvus-io/milvus/internal/http"
|
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
|
// Write will write data to response body
|
||||||
func (w *Writer) Write(data []byte) (int, error) {
|
func (w *Writer) Write(data []byte) (int, error) {
|
||||||
if w.timeout || w.body == nil {
|
if w.timeout || w.body == nil {
|
||||||
return 0, nil
|
return 0, errors.New("Response writer closed")
|
||||||
}
|
}
|
||||||
|
|
||||||
w.mu.Lock()
|
w.mu.Lock()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user