2
0

Merge pull request #1 from furdarius/increase-buffer

Increase buffer size to 8KB
This commit is contained in:
Jack Christensen
2020-02-14 17:52:59 -06:00
committed by GitHub
+5 -1
View File
@@ -39,7 +39,11 @@ func New(r io.Reader) *ChunkReader {
// NewConfig creates and a new ChunkReader for r configured by config.
func NewConfig(r io.Reader, config Config) (*ChunkReader, error) {
if config.MinBufLen == 0 {
config.MinBufLen = 4096
// By historical reasons Postgres currently has 8KB send buffer inside,
// so here we want to have at least the same size buffer.
// @see https://github.com/postgres/postgres/blob/249d64999615802752940e017ee5166e726bc7cd/src/backend/libpq/pqcomm.c#L134
// @see https://www.postgresql.org/message-id/0cdc5485-cb3c-5e16-4a46-e3b2f7a41322%40ya.ru
config.MinBufLen = 8192
}
return &ChunkReader{