From bb595d2176b2f9d6c5b42f878fa51f8201620493 Mon Sep 17 00:00:00 2001 From: KevRiver Date: Sat, 2 Nov 2024 18:26:59 +0900 Subject: [PATCH] expand scanner buffer size to 2MB --- scanner.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scanner.go b/scanner.go index e7df025..dd4739a 100644 --- a/scanner.go +++ b/scanner.go @@ -15,8 +15,11 @@ import ( // the lines aren't JSON-structured, it will simply write them out with no // prettification. func Scan(ctx context.Context, src io.Reader, sink sink.Sink, opts *HandlerOptions) error { + + const bufferMaxSize = 2 * 1024 * 1024 // 2MB + in := bufio.NewScanner(src) - in.Buffer(make([]byte, 1024*1024), 1024*1024) + in.Buffer(make([]byte, 0, bufferMaxSize), bufferMaxSize) in.Split(bufio.ScanLines) var line uint64