rethinkdb / rethinkdb-go

Go language driver for RethinkDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to connect when `TimeOut` is specified

GaikwadPratik opened this issue · comments

Describe the bug
I have connectOpts defined as

connectOpts := r.ConnectOpts{
		Timeout:    5000,
		Address:    "localhost",
		Database:   fabricContext.Config.DbName,
		Password:   pass,
		InitialCap: 20,
		MaxOpen:    20}

I get the following error:

error="rethinkdb: dial tcp: i/o timeout"

However if I remove Timeout from above, then it works. Is the Timeout supposed to be in nanosecond? Because Timeout: 1 * 1000 * 1000, also works. In that case, can you please update comment/documentation?

System info

  • OS: Ubuntu 18.04
  • RethinkDB Version: rethinkdb 2.3.6+14+g9ca0d3+dirty~0 (CLANG 6.0.0 (tags/RELEASE_600/final))
  • driver: gopkg.in/rethinkdb/rethinkdb-go.v6 v6.2.1

It's a time.Duration and it is indicated by the variable type already:

Timeout time.Duration `rethinkdb:"timeout,omitempty" json:"timeout,omitempty"`
. So, it is nano seconds and you can just do 5 * time.Second or something like that.