mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-07-04 15:32:19 +02:00
Compare commits
No commits in common. "4971ad9d42c7f9ad908d287f9abd7facf2f70e18" and "7dbcb18ebf36ff738472be995f88a26ea41cb4c5" have entirely different histories.
4971ad9d42
...
7dbcb18ebf
@ -19,7 +19,6 @@ package account
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"runtime"
|
||||
|
||||
"golang.org/x/crypto/argon2"
|
||||
)
|
||||
@ -35,13 +34,13 @@ const (
|
||||
ArgonKeySize = 32
|
||||
ArgonSaltSize = 16
|
||||
|
||||
ArgonMaxInstances = 16
|
||||
|
||||
UUIDSize = 16
|
||||
TokenSize = 32
|
||||
)
|
||||
|
||||
var (
|
||||
ArgonMaxInstances = runtime.NumCPU()
|
||||
|
||||
isValidUsername = regexp.MustCompile(`^\w{1,16}$`).MatchString
|
||||
semaphore = make(chan bool, ArgonMaxInstances)
|
||||
)
|
||||
|
9
db/db.go
9
db/db.go
@ -21,11 +21,9 @@ import (
|
||||
"database/sql"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
|
||||
var handle *sql.DB
|
||||
@ -38,10 +36,7 @@ func Init(username, password, protocol, address, database string) error {
|
||||
return fmt.Errorf("failed to open database connection: %s", err)
|
||||
}
|
||||
|
||||
handle.SetMaxIdleConns(256)
|
||||
handle.SetMaxOpenConns(256)
|
||||
handle.SetConnMaxIdleTime(time.Second * 30)
|
||||
handle.SetConnMaxLifetime(time.Minute)
|
||||
handle.SetMaxOpenConns(1000)
|
||||
|
||||
tx, err := handle.Begin()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user