Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Allows RethinkDB timeout to be configured #72

Merged
merged 1 commit into from
May 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkg/adaptor/rethinkdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type rethinkDbConfig struct {
Namespace string `json:"namespace" doc:"rethink namespace to read/write, in the form database.table"`
Debug bool `json:"debug" doc:"if true, verbose debugging information is displayed"`
Tail bool `json:"tail" doc:"if true, the RethinkDB table will be monitored for changes after copying the namespace"`
Timeout int `json:"timeout" doc:"timeout, in seconds, for connect, read, and write operations to the RethinkDB server; default is 10"`
}

type rethinkDbChangeNotification struct {
Expand Down Expand Up @@ -93,11 +94,16 @@ func NewRethinkdb(p *pipe.Pipe, path string, extra Config) (StopStartListener, e
}
r.debug = conf.Debug

r.client, err = gorethink.Connect(gorethink.ConnectOpts{
opts := gorethink.ConnectOpts{
Address: r.uri.Host,
MaxIdle: 10,
Timeout: time.Second * 10,
})
}
if conf.Timeout > 0 {
opts.Timeout = time.Duration(conf.Timeout) * time.Second
}

r.client, err = gorethink.Connect(opts)
if err != nil {
return r, err
}
Expand Down