Prevent elapsedTime to be negative (#467)

Also fix the `elapsedTime` for Redis.
This commit is contained in:
M. Mert Yıldıran
2021-11-16 02:52:48 +03:00
committed by GitHub
parent 58a1eac247
commit a6bf39fad5
3 changed files with 12 additions and 1 deletions

View File

@@ -184,6 +184,9 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
}
elapsedTime := item.Pair.Response.CaptureTime.Sub(item.Pair.Request.CaptureTime).Round(time.Millisecond).Milliseconds()
if elapsedTime < 0 {
elapsedTime = 0
}
httpPair, _ := json.Marshal(item.Pair)
_protocol := protocol
_protocol.Version = item.Protocol.Version