diff --git a/README.md b/README.md index c827ef2..4c7a6c0 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` | int64 | no | 5 | | `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..9e3fc7d 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(time.Duration(s.config.Dcp.ConnectionTimeout)*time.Second), gocbcore.WaitUntilReadyOptions{ RetryStrategy: gocbcore.NewBestEffortRetryStrategy(nil), }, diff --git a/helpers/config.go b/helpers/config.go index 1fca022..bf4d122 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 int64 `yaml:"ConnectionTimeout" default:"5"` Listener ConfigDCPListener `yaml:"listener"` }