mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
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:
+4
-2
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user