feat: add 5 experiment

This commit is contained in:
TAskMAster339
2026-10-10 21:32:33 +03:00
parent 6892af8842
commit 715f6c4175
1397 changed files with 271651 additions and 56 deletions
+8
View File
@@ -6,6 +6,7 @@ import (
"embed"
"errors"
"os"
"strconv"
"strings"
"time"
@@ -43,6 +44,13 @@ func OpenDatabase(ctx context.Context) (*pgxpool.Pool, error) {
return nil, err
}
cfg.MaxConns = 10
if value := os.Getenv("DATABASE_MAX_CONNS"); value != "" {
maxConns, parseErr := strconv.Atoi(value)
if parseErr != nil || maxConns < 1 || maxConns > 100 {
return nil, errors.New("DATABASE_MAX_CONNS must be between 1 and 100")
}
cfg.MaxConns = int32(maxConns)
}
cfg.ConnConfig.ConnectTimeout = 5 * time.Second
db, err := pgxpool.NewWithConfig(ctx, cfg)
if err != nil {