Fix replay of requests with timestampp in "past"

In some rare cases, requests can be recorded out of order.
It was causing replay from file significanty slodown when such issue met.
Now it replays them but without adding sleep.
This commit is contained in:
Leonid Bugaev
2021-07-01 23:27:34 +03:00
parent b6cc6a3606
commit 92c63de753
+4 -2
View File
@@ -238,13 +238,15 @@ func (i *FileInput) emit() {
if lastTime != -1 {
diff := reader.timestamp - lastTime
lastTime = reader.timestamp
if i.speedFactor != 1 {
diff = int64(float64(diff) / i.speedFactor)
}
time.Sleep(time.Duration(diff))
if diff >= 0 {
lastTime = reader.timestamp
time.Sleep(time.Duration(diff))
}
} else {
lastTime = reader.timestamp
}