From dcb78991c4c002f7c839eb15191882c07b47e0bc Mon Sep 17 00:00:00 2001 From: Tao Wen <taowen@gmail.com> Date: Tue, 6 Jun 2017 14:16:54 +0800 Subject: [PATCH] flush when buffer is large enough --- feature_stream.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature_stream.go b/feature_stream.go index 6da5e1d..b0ba53f 100644 --- a/feature_stream.go +++ b/feature_stream.go @@ -164,7 +164,7 @@ func (b *Stream) Flush() error { func (b *Stream) ensure(minimal int) { available := b.Available() if available < minimal { - if available < 128 { + if b.n > 1024 { b.Flush() } b.growAtLeast(minimal)