rethinkdb / rethinkdb-go

Go language driver for RethinkDB
Apache License 2.0
1.65k stars 182 forks source link

disable the read timeout in background go routine #468

Closed causton81 closed 4 years ago

causton81 commented 5 years ago

the channel is always being read in the background even if the application is not doing any queries.

I happened to be doing some testing with NumRetries=1 (effectively no retries), InitialCap > 0 and ReadTimeout > 0. I was surprised when I encountered rethinkdb: the connection is closed errors. This patch seems to work okay for me and I believe individual Query()'s still set a Context deadline.

The second Run() call in the new integration test returns an error on current master:

 RETHINK_ADDR=25.0.2.100:28015 go test .

----------------------------------------------------------------------
FAIL: connection_test.go:526: ConnectionSuite.TestConnection_idleConnectionRemainsUsable

connection_test.go:551:
    c.Assert(err, test.IsNil)
... value *errors.errorString = &errors.errorString{s:"rethinkdb: the connection is closed"} ("rethinkdb: the connection is closed")

OOPS: 35 passed, 1 FAILED
--- FAIL: Test (6.07s)
FAIL
FAIL    gopkg.in/rethinkdb/rethinkdb-go.v5  6.108s

Passing with patch:

RETHINK_ADDR=25.0.2.100:28015 go test .
ok      gopkg.in/rethinkdb/rethinkdb-go.v5  6.513s
CMogilko commented 4 years ago

Was fixed in #478