1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-04 00:44:21 +00:00

Modify log format and don't print network error (#546)

* Modify log format and don't print network error

* Don't print network error and content canceled error

* Modify function name
This commit is contained in:
feiniks
2022-03-02 16:03:16 +08:00
committed by GitHub
parent 35f6678c1c
commit 96b33251ce
10 changed files with 92 additions and 29 deletions

View File

@@ -9,7 +9,6 @@ import (
"fmt"
"html"
"io/ioutil"
"log"
"net"
"net/http"
"strconv"
@@ -25,6 +24,7 @@ import (
"github.com/haiwen/seafile-server/fileserver/fsmgr"
"github.com/haiwen/seafile-server/fileserver/repomgr"
"github.com/haiwen/seafile-server/fileserver/share"
log "github.com/sirupsen/logrus"
)
type checkExistType int32
@@ -730,8 +730,6 @@ func putSendBlockCB(rsp http.ResponseWriter, r *http.Request) *appError {
return &appError{err, "", http.StatusInternalServerError}
}
rsp.WriteHeader(http.StatusOK)
sendStatisticMsg(storeID, user, "sync-file-upload", uint64(r.ContentLength))
return nil
@@ -770,7 +768,10 @@ func getBlockInfo(rsp http.ResponseWriter, r *http.Request) *appError {
blockLen := fmt.Sprintf("%d", blockSize)
rsp.Header().Set("Content-Length", blockLen)
if err := blockmgr.Read(storeID, blockID, rsp); err != nil {
return &appError{err, "", http.StatusInternalServerError}
if !isNetworkErr(err) {
log.Printf("failed to read block %s: %v", blockID, err)
}
return nil
}
sendStatisticMsg(storeID, user, "sync-file-download", uint64(blockSize))