mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
Added time --input-raw-max-wait
In some low traffic cases you can have cases when time between request minutes. Additionally increasing speed can be not an option. Now you can "skip" this pauses, by seetting max wait time
This commit is contained in:
+7
-1
@@ -196,12 +196,13 @@ type FileInput struct {
|
||||
loop bool
|
||||
readDepth int
|
||||
dryRun bool
|
||||
maxWait time.Duration
|
||||
|
||||
stats *expvar.Map
|
||||
}
|
||||
|
||||
// NewFileInput constructor for FileInput. Accepts file path as argument.
|
||||
func NewFileInput(path string, loop bool, readDepth int, dryRun bool) (i *FileInput) {
|
||||
func NewFileInput(path string, loop bool, readDepth int, maxWait time.Duration, dryRun bool) (i *FileInput) {
|
||||
i = new(FileInput)
|
||||
i.data = make(chan []byte, 1000)
|
||||
i.exit = make(chan bool)
|
||||
@@ -211,6 +212,7 @@ func NewFileInput(path string, loop bool, readDepth int, dryRun bool) (i *FileIn
|
||||
i.readDepth = readDepth
|
||||
i.stats = expvar.NewMap("file-" + path)
|
||||
i.dryRun = dryRun
|
||||
i.maxWait = maxWait
|
||||
|
||||
if err := i.init(); err != nil {
|
||||
return
|
||||
@@ -351,6 +353,10 @@ func (i *FileInput) emit() {
|
||||
diff = int64(float64(diff) / i.speedFactor)
|
||||
}
|
||||
|
||||
if i.maxWait > 0 && diff > int64(i.maxWait) {
|
||||
diff = int64(i.maxWait)
|
||||
}
|
||||
|
||||
if diff >= 0 {
|
||||
lastTime = payload.timestamp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user