Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.8.3-dev' into 1.8.3-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Nov 1, 2018
2 parents 7b994de + 7bf3031 commit 29feb1f
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions controller/pjaxmidware.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package controller

import (
"strings"
"time"

"github.com/gin-gonic/gin"
)
Expand Down Expand Up @@ -52,8 +51,6 @@ func (p *pjaxHTMLWriter) Write(data []byte) (int, error) {
return 0, nil
}

start := time.Now()

pjaxContainer := p.c.Request.Header.Get("X-PJAX-Container")
body := p.bodyBuilder.String()
startTag := "<!---- pjax {" + pjaxContainer + "} start ---->"
Expand All @@ -76,25 +73,11 @@ func (p *pjaxHTMLWriter) Write(data []byte) (int, error) {
part = part[end+len(endTag):]
}

time.Sleep(time.Millisecond * 100)

defer func() {
end := time.Now()
elapsed := end.Sub(start)
logger.Infof("start: %dms, end: %dms, elapsed: %dms",
start.UnixNano()/1000/1000, end.UnixNano()/1000/1000, elapsed.Nanoseconds()/1000/1000)
}()

var i int
var e error
if 0 == len(containers) {
i, e = p.ResponseWriter.WriteString(body)
p.ResponseWriter.Flush()

return i, e
if 0 != len(containers) {
body = strings.Join(containers, "")
}

i, e = p.ResponseWriter.WriteString(strings.Join(containers, ""))
i, e := p.ResponseWriter.WriteString(body)
p.ResponseWriter.Flush()

return i, e
Expand Down

0 comments on commit 29feb1f

Please sign in to comment.