mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 06:12:25 -05:00
[chore] set max open / idle conns + conn max lifetime for both postgres and sqlite (#1369)
* [chore] set max open / idle conns + conn max lifetime for both postgres and sqlite * reduce cache size default to 8MiB, reduce connections to 2 * cpu * introduce max open conns multiplier, tune sqlite and pg separately * go fmt
This commit is contained in:
parent
17eecfb6d9
commit
782169da76
9 changed files with 212 additions and 121 deletions
|
|
@ -524,6 +524,31 @@ func GetDbTLSCACert() string { return global.GetDbTLSCACert() }
|
|||
// SetDbTLSCACert safely sets the value for global configuration 'DbTLSCACert' field
|
||||
func SetDbTLSCACert(v string) { global.SetDbTLSCACert(v) }
|
||||
|
||||
// GetDbMaxOpenConnsMultiplier safely fetches the Configuration value for state's 'DbMaxOpenConnsMultiplier' field
|
||||
func (st *ConfigState) GetDbMaxOpenConnsMultiplier() (v int) {
|
||||
st.mutex.Lock()
|
||||
v = st.config.DbMaxOpenConnsMultiplier
|
||||
st.mutex.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// SetDbMaxOpenConnsMultiplier safely sets the Configuration value for state's 'DbMaxOpenConnsMultiplier' field
|
||||
func (st *ConfigState) SetDbMaxOpenConnsMultiplier(v int) {
|
||||
st.mutex.Lock()
|
||||
defer st.mutex.Unlock()
|
||||
st.config.DbMaxOpenConnsMultiplier = v
|
||||
st.reloadToViper()
|
||||
}
|
||||
|
||||
// DbMaxOpenConnsMultiplierFlag returns the flag name for the 'DbMaxOpenConnsMultiplier' field
|
||||
func DbMaxOpenConnsMultiplierFlag() string { return "db-max-open-conns-multiplier" }
|
||||
|
||||
// GetDbMaxOpenConnsMultiplier safely fetches the value for global configuration 'DbMaxOpenConnsMultiplier' field
|
||||
func GetDbMaxOpenConnsMultiplier() int { return global.GetDbMaxOpenConnsMultiplier() }
|
||||
|
||||
// SetDbMaxOpenConnsMultiplier safely sets the value for global configuration 'DbMaxOpenConnsMultiplier' field
|
||||
func SetDbMaxOpenConnsMultiplier(v int) { global.SetDbMaxOpenConnsMultiplier(v) }
|
||||
|
||||
// GetDbSqliteJournalMode safely fetches the Configuration value for state's 'DbSqliteJournalMode' field
|
||||
func (st *ConfigState) GetDbSqliteJournalMode() (v string) {
|
||||
st.mutex.Lock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue