From a5da983c102760066f6bd3bd8bdbe89a0d2ea5f5 Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Tue, 23 Jun 2026 04:53:33 +0800 Subject: [PATCH] fix(runtime): cap d601 v03 postgres pools (#1949) --- deploy/deploy.yaml | 5 +++-- internal/userbilling/service.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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