refactoring

This commit is contained in:
Chris Lu
2019-06-25 09:49:27 -07:00
parent fdff927b37
commit 359563e95a
3 changed files with 19 additions and 14 deletions

View File

@@ -11,7 +11,6 @@ import (
"path"
"strconv"
"strings"
"time"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
@@ -21,10 +20,6 @@ import (
func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) {
stats.FilerRequestCounter.WithLabelValues("get").Inc()
start := time.Now()
defer func() { stats.FilerRequestHistogram.WithLabelValues("get").Observe(time.Since(start).Seconds()) }()
path := r.URL.Path
if strings.HasSuffix(path, "/") && len(path) > 1 {
path = path[:len(path)-1]
@@ -61,7 +56,6 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
w.Header().Set("Accept-Ranges", "bytes")
if r.Method == "HEAD" {
stats.FilerRequestCounter.WithLabelValues("head").Inc()
w.Header().Set("Content-Length", strconv.FormatInt(int64(filer2.TotalSize(entry.Chunks)), 10))
w.Header().Set("Last-Modified", entry.Attr.Mtime.Format(http.TimeFormat))
setEtag(w, filer2.ETag(entry.Chunks))