Fix login stalls and bot redemption routing

This commit is contained in:
ShukeBta
2026-06-15 01:00:05 +08:00
parent 479a06f008
commit 904701f29f
9 changed files with 244 additions and 18 deletions
+2 -2
View File
@@ -22,8 +22,8 @@ import (
const EnvPrefix = "MEDIASTATION"
const (
defaultDatabaseMaxOpenConns = 1
defaultDatabaseMaxIdleConns = 1
defaultDatabaseMaxOpenConns = 4
defaultDatabaseMaxIdleConns = 2
)
// Config 是根配置聚合。
+6 -3
View File
@@ -75,7 +75,7 @@ func TestEnvOverride(t *testing.T) {
}
}
func TestLoadAllowsSingleConnectionDatabaseConfig(t *testing.T) {
func TestLoadAllowsExplicitSingleConnectionDatabaseConfig(t *testing.T) {
dir := t.TempDir()
wd, _ := os.Getwd()
defer func() { _ = os.Chdir(wd) }()
@@ -90,7 +90,10 @@ func TestLoadAllowsSingleConnectionDatabaseConfig(t *testing.T) {
if err != nil {
t.Fatalf("Load() error: %v", err)
}
if cfg.Database.MaxOpenConns != defaultDatabaseMaxOpenConns {
t.Fatalf("expected MaxOpenConns=1 to remain at safe default %d, got %d", defaultDatabaseMaxOpenConns, cfg.Database.MaxOpenConns)
if cfg.Database.MaxOpenConns != 1 {
t.Fatalf("expected explicit MaxOpenConns=1 to be preserved, got %d", cfg.Database.MaxOpenConns)
}
if cfg.Database.MaxIdleConns != 1 {
t.Fatalf("expected explicit MaxIdleConns=1 to be preserved, got %d", cfg.Database.MaxIdleConns)
}
}