mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-23 22:13:36 +08:00
[volume] requests that were canceled by the client are not an internal server problem(500 => 499) (#5304)
This commit is contained in:

committed by
GitHub

parent
3d463ef471
commit
8fb978d6f6
@@ -50,7 +50,7 @@ func (fs *FilerServer) autoChunk(ctx context.Context, w http.ResponseWriter, r *
|
|||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.HasPrefix(err.Error(), "read input:") || err.Error() == io.ErrUnexpectedEOF.Error() {
|
if strings.HasPrefix(err.Error(), "read input:") || err.Error() == io.ErrUnexpectedEOF.Error() {
|
||||||
writeJsonError(w, r, 499, err)
|
writeJsonError(w, r, util.HttpStatusCancelled, err)
|
||||||
} else if strings.HasSuffix(err.Error(), "is a file") || strings.HasSuffix(err.Error(), "already exists") {
|
} else if strings.HasSuffix(err.Error(), "is a file") || strings.HasSuffix(err.Error(), "already exists") {
|
||||||
writeJsonError(w, r, http.StatusConflict, err)
|
writeJsonError(w, r, http.StatusConflict, err)
|
||||||
} else {
|
} else {
|
||||||
|
@@ -53,7 +53,7 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque
|
|||||||
select {
|
select {
|
||||||
case <-r.Context().Done():
|
case <-r.Context().Done():
|
||||||
glog.V(4).Infof("request cancelled from %s: %v", r.RemoteAddr, r.Context().Err())
|
glog.V(4).Infof("request cancelled from %s: %v", r.RemoteAddr, r.Context().Err())
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(util.HttpStatusCancelled)
|
||||||
vs.inFlightDownloadDataLimitCond.L.Unlock()
|
vs.inFlightDownloadDataLimitCond.L.Unlock()
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
|
@@ -4,6 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const HttpStatusCancelled = 499
|
||||||
|
|
||||||
var (
|
var (
|
||||||
VERSION_NUMBER = fmt.Sprintf("%.02f", 3.62)
|
VERSION_NUMBER = fmt.Sprintf("%.02f", 3.62)
|
||||||
VERSION = sizeLimit + " " + VERSION_NUMBER
|
VERSION = sizeLimit + " " + VERSION_NUMBER
|
||||||
|
Reference in New Issue
Block a user