Skip to content

Commit

Permalink
time-tracking for HTTP/3 with keep-alive
Browse files Browse the repository at this point in the history
  • Loading branch information
rbarazzutti committed Aug 15, 2023
1 parent ba32f04 commit 95c8ba8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/webclientimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (webClient *webClientImpl) DoMeasure(followRedirect bool) *HTTPMeasure {
remoteAddr = info.Conn.RemoteAddr().String()
timerRegistry.Get(stats.Conn).Stop()
timerRegistry.Get(stats.Req).Start()
timerRegistry.Get(stats.ReqAndWait).Start()
timerRegistry.Get(stats.ReqAndWait).StartForce()
reused = info.Reused
},

Expand Down Expand Up @@ -330,6 +330,7 @@ func (webClient *webClientImpl) DoMeasure(followRedirect bool) *HTTPMeasure {
webClient.prepareReq(req)

timerRegistry.Get(stats.Total).Start()
timerRegistry.Get(stats.ReqAndWait).Start() // for HTTP/3 with keep-alive

res, err := webClient.httpClient.Do(req)

Expand Down
4 changes: 4 additions & 0 deletions stats/timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func (t *Timer) Start() {
}
}

func (t *Timer) StartForce() {
t.startTime = time.Now()
}

func (t *Timer) Stop() {
ts := time.Now()
if ts.After(t.stopTime) {
Expand Down

0 comments on commit 95c8ba8

Please sign in to comment.