~evanj/cms

afc228cb59683180b3b2957aceb6bf1aa0bf0d0e — Evan J 2 months ago 81247c6
Feat(db): Tweaking db.SetMaxOpenConns, db.SetMaxIdleConns, and
db.SetConnMaxLifetime further.
1 files changed, 8 insertions(+), 0 deletions(-)

M internal/s/db/db.go
M internal/s/db/db.go => internal/s/db/db.go +8 -0
@@ 8,6 8,7 @@ import (
	"sort"
	"strconv"
	"strings"
	"time"

	"git.sr.ht/~evanj/cms/internal/m/role"
	"git.sr.ht/~evanj/cms/internal/m/valuetype"


@@ 105,6 106,13 @@ func (db *DB) Setup() error {
		return err
	}

	// NOTE: Might want to tweaks. These are good starting values. See
	// https://www.alexedwards.net/blog/configuring-sqldb
	// TODO: Should thread context through data layer code.
	db.SetMaxOpenConns(25)
	db.SetMaxIdleConns(25)
	db.SetConnMaxLifetime(1 * time.Minute)

	return nil
}