diff --git a/deploy/deploy.yaml b/deploy/deploy.yaml index 6abdadb0..82767783 100644 --- a/deploy/deploy.yaml +++ b/deploy/deploy.yaml @@ -301,7 +301,7 @@ lanes: port: 5432 runtimeStore: postgres: - poolMax: 16 + poolMax: 4 connectionTimeoutMs: 5000 queryRetryMaxAttempts: 5 queryRetryInitialDelayMs: 250 @@ -314,7 +314,7 @@ lanes: backoffBaseMs: 0 backoffMaxMs: 1 postgres: - poolMax: 4 + poolMax: 2 queryTimeoutMs: 3000 readyTimeoutMs: 2000 cache: @@ -599,6 +599,7 @@ lanes: - serviceId: hwlab-user-billing env: HWLAB_USER_BILLING_DB_URL: secretRef:hwlab-cloud-api-v03-db/database-url + HWLAB_USER_BILLING_DB_POOL_MAX: "2" HWLAB_BOOTSTRAP_ADMIN_ID: usr_v03_admin HWLAB_BOOTSTRAP_ADMIN_USERNAME: admin HWLAB_BOOTSTRAP_ADMIN_DISPLAY_NAME: HWLAB v0.3 Admin diff --git a/internal/userbilling/service.go b/internal/userbilling/service.go index 40c186dd..f6035b78 100644 --- a/internal/userbilling/service.go +++ b/internal/userbilling/service.go @@ -352,7 +352,7 @@ func NewServer(ctx context.Context, cfg Config) (*Server, error) { if err != nil { return nil, err } - db.SetMaxOpenConns(8) + db.SetMaxOpenConns(envInt("HWLAB_USER_BILLING_DB_POOL_MAX", 4)) db.SetMaxIdleConns(4) db.SetConnMaxLifetime(30 * time.Minute) server.db = db