diff --git a/README.md b/README.md index efab7d5..41b4983 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ On startup each adapter initializes the minimum resource it owns, then every tic Each configured service starts independently. If one service cannot connect, it logs the error and retries without stopping other services in the same deployment. -For hosted Couchbase/Capella clusters, `ready_timeout` defaults to `2m`. If Couchbase still reports `CONNECTION_ERROR`, check the connection string, bucket name, database user permissions, and Capella allowed IP/network access. +For hosted Couchbase/Capella clusters, `ready_timeout` defaults to `30s`. If Couchbase reports `CONNECTION_ERROR`, check the connection string, bucket name, database user permissions, and Capella allowed IP/network access. ## Adding a new adapter diff --git a/adapter/couchbase_initialization.go b/adapter/couchbase_initialization.go index 30b3630..9b10018 100644 --- a/adapter/couchbase_initialization.go +++ b/adapter/couchbase_initialization.go @@ -9,7 +9,7 @@ import ( "github.com/couchbase/gocb/v2" ) -const defaultCouchbaseReadyTimeout = 2 * time.Minute +const defaultCouchbaseReadyTimeout = 30 * time.Second func (a *couchbaseAdapter) bucketReadyError(err error) error { return fmt.Errorf( diff --git a/adapter/couchbase_test.go b/adapter/couchbase_test.go index decf1e1..9f78c14 100644 --- a/adapter/couchbase_test.go +++ b/adapter/couchbase_test.go @@ -31,7 +31,7 @@ func TestCouchbaseFactoryParsesInitializationOptions(t *testing.T) { } } -func TestCouchbaseFactoryUsesHostedReadyTimeoutDefault(t *testing.T) { +func TestCouchbaseFactoryUsesReadyTimeoutDefault(t *testing.T) { a, err := New("couchbase", Config{ "connection_string": "couchbases://cb.example.com", "username": "user", @@ -45,8 +45,8 @@ func TestCouchbaseFactoryUsesHostedReadyTimeoutDefault(t *testing.T) { } got := a.(*couchbaseAdapter) - if got.readyTimeout != 2*time.Minute { - t.Fatalf("readyTimeout = %s, want 2m", got.readyTimeout) + if got.readyTimeout != 30*time.Second { + t.Fatalf("readyTimeout = %s, want 30s", got.readyTimeout) } } @@ -67,13 +67,13 @@ func TestCouchbaseFactoryRejectsInvalidReadyTimeout(t *testing.T) { func TestCouchbaseBucketReadyErrorAddsActionableContext(t *testing.T) { cause := errors.New("unambiguous timeout") - a := couchbaseAdapter{bucket: "keepalive", readyTimeout: 2 * time.Minute} + a := couchbaseAdapter{bucket: "keepalive", readyTimeout: 30 * time.Second} err := a.bucketReadyError(cause) if !errors.Is(err, cause) { t.Fatalf("bucketReadyError does not wrap cause: %v", err) } - for _, want := range []string{"keepalive", "2m0s", "Capella allowed IP", "ready_timeout"} { + for _, want := range []string{"keepalive", "30s", "Capella allowed IP", "ready_timeout"} { if !strings.Contains(err.Error(), want) { t.Fatalf("bucketReadyError() = %q, want it to contain %q", err, want) } diff --git a/config.example.yml b/config.example.yml index a5d5e84..b42c381 100644 --- a/config.example.yml +++ b/config.example.yml @@ -25,6 +25,6 @@ services: bucket_name: keepalive scope_name: _default collection_name: _default - ready_timeout: 2m + ready_timeout: 30s # Optional. Set only when this user can create a missing bucket. # bucket_ram_quota_mb: 128