File tree 1 file changed +6
-10
lines changed
1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -1251,19 +1251,15 @@ func (r *Request) TraceInfo() TraceInfo {
1251
1251
RequestAttempt : r .Attempt ,
1252
1252
}
1253
1253
1254
- // Calculate the total time accordingly,
1255
- // when connection is reused
1256
- var requestStartTime time.Time
1257
- if ct .gotConnInfo .Reused {
1254
+ requestStartTime := r .Time
1255
+ // Calculate the total time accordingly when connection is reused,
1256
+ // and DNS start and get conn time may be zero if the request is invalid.
1257
+ // See issue #1016.
1258
+ if ct .gotConnInfo .Reused && ! ct .getConn .IsZero () {
1258
1259
requestStartTime = ct .getConn
1259
- } else {
1260
+ } else if ! ct . dnsStart . IsZero () {
1260
1261
requestStartTime = ct .dnsStart
1261
1262
}
1262
- // DNS start and get conn time may be zero if the request is invalid.
1263
- // See issue #1016.
1264
- if requestStartTime .IsZero () {
1265
- requestStartTime = r .Time
1266
- }
1267
1263
ti .TotalTime = ct .endTime .Sub (requestStartTime )
1268
1264
1269
1265
// Only calculate on successful connections
You can’t perform that action at this time.
0 commit comments