diff --git a/README.md b/README.md index c827ef2..70b4aca 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ $ go get github.com/Trendyol/go-dcp-client | `collectionNames` | []string | no | _default | | `dcp.bufferSizeKb` | int | no | 16384 | | `dcp.connectionBufferSizeKb` | uint | no | 20480 | +| `dcp.connectionTimeout` | time.Duration | no | 5s | | `dcp.listener.bufferSize` | int | no | 1 | | `dcp.group.membership.memberNumber` | int | no | 1 | | `dcp.group.membership.totalMembers` | int | no | 1 | diff --git a/dcp/client.go b/dcp/client.go index 2fc9dd2..7b8c0bf 100644 --- a/dcp/client.go +++ b/dcp/client.go @@ -141,7 +141,7 @@ func (s *client) connect(bucketName string) (*gocbcore.Agent, error) { ch := make(chan error) _, err = client.WaitUntilReady( - time.Now().Add(time.Second*5), + time.Now().Add(s.config.Dcp.ConnectionTimeout), gocbcore.WaitUntilReadyOptions{ RetryStrategy: gocbcore.NewBestEffortRetryStrategy(nil), }, diff --git a/helpers/config.go b/helpers/config.go index 1fca022..8d8de5c 100644 --- a/helpers/config.go +++ b/helpers/config.go @@ -29,6 +29,7 @@ type ConfigDCP struct { Group ConfigDCPGroup `yaml:"group"` BufferSizeKb int `yaml:"bufferSizeKb" default:"16384"` ConnectionBufferSizeKb uint `yaml:"connectionBufferSizeKb" default:"20480"` + ConnectionTimeout time.Duration `yaml:"connectionTimeout" default:"5"` Listener ConfigDCPListener `yaml:"listener"` }