worth a shot

This commit is contained in:
pigwin
2025-12-23 13:24:20 +00:00
parent 5171dcf4f6
commit 7424600a8b
9 changed files with 658 additions and 453 deletions

View File

@@ -10,8 +10,8 @@
"valkey": {
"host": "127.0.0.1",
"port": "6379",
"max_conns": 50,
"timeout_ms": 5000,
"max_conns": 110,
"timeout_ms": 2000,
"password": "the_valkey_password"
},
"temp": "value"

View File

@@ -27,10 +27,11 @@ func ConnectToPostgreSQL() (*sql.DB, error) {
return nil, err
}
// Set connection pool settings
db.SetMaxOpenConns(25) // Maximum number of open connections to the database
db.SetMaxIdleConns(25) // Maximum number of connections in the idle connection pool
db.SetConnMaxLifetime(1 * time.Hour) // Maximum amount of time a connection may be reused
// Set connection pool settings for high concurrency
db.SetMaxOpenConns(100) // Maximum number of open connections to the database
db.SetMaxIdleConns(50) // Maximum number of connections in the idle connection pool
db.SetConnMaxLifetime(1 * time.Hour) // Maximum amount of time a connection may be reused
db.SetConnMaxIdleTime(5 * time.Minute) // Maximum amount of time a connection may be idle
fmt.Println("Connection to PostgreSQL opened successfully :D")