Allow input file read ahead

Input file now pre-reads N requests, sort them by timestamp and emit on demand.
You can control read depth using --input-file-read-depth which is 100 by default.

It makes implementaiton faster, and it fix various issues when due to concurrenccy, or another issues requests gets addeed out of order.
This commit is contained in:
Leonid Bugaev
2021-07-08 10:30:22 +03:00
parent 889c1e6d41
commit 625ed54f1e
8 changed files with 134 additions and 41 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ func TestFileOutput(t *testing.T) {
emitter.Close()
var counter int64
input2 := NewFileInput("/tmp/test_requests.gor", false)
input2 := NewFileInput("/tmp/test_requests.gor", false, 100)
output2 := NewTestOutput(func(*Message) {
atomic.AddInt64(&counter, 1)
wg.Done()