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

Commit

Permalink
Merge pull request #72 from alindeman/rethinkdb/configurable-timeout
Browse files Browse the repository at this point in the history
Allows RethinkDB timeout to be configured
  • Loading branch information
nstott committed May 11, 2015
2 parents 6cbf359 + 60ff52c commit a2dd7a3
Showing 1 changed file with 8 additions and 2 deletions.
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

0 comments on commit a2dd7a3

Please sign in to comment.