diff options
author | 2023-07-07 11:34:12 +0200 | |
---|---|---|
committer | 2023-07-07 11:34:12 +0200 | |
commit | e70bf8a6c82e3d5c943550b364fc6f8120f6f07e (patch) | |
tree | f408ccff2e6f2451bf95ee9a5d96e5b678d686d5 /internal/config | |
parent | [chore/performance] Remove remaining 'whereEmptyOrNull' funcs (#1946) (diff) | |
download | gotosocial-e70bf8a6c82e3d5c943550b364fc6f8120f6f07e.tar.xz |
[chore/bugfix] Domain block tidying up, Implement first pass of `207 Multi-Status` (#1886)
* [chore/refactor] update domain block processing
* expose domain block import errors a lil better
* move/remove unused query keys
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 4 | ||||
-rw-r--r-- | internal/config/defaults.go | 4 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 75 |
3 files changed, 83 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 8dcbcaf97..c809bbc1b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -200,6 +200,10 @@ type GTSCacheConfiguration struct { FollowRequestTTL time.Duration `name:"follow-request-ttl"` FollowRequestSweepFreq time.Duration `name:"follow-request-sweep-freq"` + InstanceMaxSize int `name:"instance-max-size"` + InstanceTTL time.Duration `name:"instance-ttl"` + InstanceSweepFreq time.Duration `name:"instance-sweep-freq"` + ListMaxSize int `name:"list-max-size"` ListTTL time.Duration `name:"list-ttl"` ListSweepFreq time.Duration `name:"list-sweep-freq"` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index c11f436d6..1cb53c8e2 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -154,6 +154,10 @@ var Defaults = Configuration{ FollowRequestTTL: time.Minute * 30, FollowRequestSweepFreq: time.Minute, + InstanceMaxSize: 2000, + InstanceTTL: time.Minute * 30, + InstanceSweepFreq: time.Minute, + ListMaxSize: 2000, ListTTL: time.Minute * 30, ListSweepFreq: time.Minute, diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 16865f32c..c82eba3b3 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -2828,6 +2828,81 @@ func GetCacheGTSFollowRequestSweepFreq() time.Duration { // SetCacheGTSFollowRequestSweepFreq safely sets the value for global configuration 'Cache.GTS.FollowRequestSweepFreq' field func SetCacheGTSFollowRequestSweepFreq(v time.Duration) { global.SetCacheGTSFollowRequestSweepFreq(v) } +// GetCacheGTSInstanceMaxSize safely fetches the Configuration value for state's 'Cache.GTS.InstanceMaxSize' field +func (st *ConfigState) GetCacheGTSInstanceMaxSize() (v int) { + st.mutex.Lock() + v = st.config.Cache.GTS.InstanceMaxSize + st.mutex.Unlock() + return +} + +// SetCacheGTSInstanceMaxSize safely sets the Configuration value for state's 'Cache.GTS.InstanceMaxSize' field +func (st *ConfigState) SetCacheGTSInstanceMaxSize(v int) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.GTS.InstanceMaxSize = v + st.reloadToViper() +} + +// CacheGTSInstanceMaxSizeFlag returns the flag name for the 'Cache.GTS.InstanceMaxSize' field +func CacheGTSInstanceMaxSizeFlag() string { return "cache-gts-instance-max-size" } + +// GetCacheGTSInstanceMaxSize safely fetches the value for global configuration 'Cache.GTS.InstanceMaxSize' field +func GetCacheGTSInstanceMaxSize() int { return global.GetCacheGTSInstanceMaxSize() } + +// SetCacheGTSInstanceMaxSize safely sets the value for global configuration 'Cache.GTS.InstanceMaxSize' field +func SetCacheGTSInstanceMaxSize(v int) { global.SetCacheGTSInstanceMaxSize(v) } + +// GetCacheGTSInstanceTTL safely fetches the Configuration value for state's 'Cache.GTS.InstanceTTL' field +func (st *ConfigState) GetCacheGTSInstanceTTL() (v time.Duration) { + st.mutex.Lock() + v = st.config.Cache.GTS.InstanceTTL + st.mutex.Unlock() + return +} + +// SetCacheGTSInstanceTTL safely sets the Configuration value for state's 'Cache.GTS.InstanceTTL' field +func (st *ConfigState) SetCacheGTSInstanceTTL(v time.Duration) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.GTS.InstanceTTL = v + st.reloadToViper() +} + +// CacheGTSInstanceTTLFlag returns the flag name for the 'Cache.GTS.InstanceTTL' field +func CacheGTSInstanceTTLFlag() string { return "cache-gts-instance-ttl" } + +// GetCacheGTSInstanceTTL safely fetches the value for global configuration 'Cache.GTS.InstanceTTL' field +func GetCacheGTSInstanceTTL() time.Duration { return global.GetCacheGTSInstanceTTL() } + +// SetCacheGTSInstanceTTL safely sets the value for global configuration 'Cache.GTS.InstanceTTL' field +func SetCacheGTSInstanceTTL(v time.Duration) { global.SetCacheGTSInstanceTTL(v) } + +// GetCacheGTSInstanceSweepFreq safely fetches the Configuration value for state's 'Cache.GTS.InstanceSweepFreq' field +func (st *ConfigState) GetCacheGTSInstanceSweepFreq() (v time.Duration) { + st.mutex.Lock() + v = st.config.Cache.GTS.InstanceSweepFreq + st.mutex.Unlock() + return +} + +// SetCacheGTSInstanceSweepFreq safely sets the Configuration value for state's 'Cache.GTS.InstanceSweepFreq' field +func (st *ConfigState) SetCacheGTSInstanceSweepFreq(v time.Duration) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.GTS.InstanceSweepFreq = v + st.reloadToViper() +} + +// CacheGTSInstanceSweepFreqFlag returns the flag name for the 'Cache.GTS.InstanceSweepFreq' field +func CacheGTSInstanceSweepFreqFlag() string { return "cache-gts-instance-sweep-freq" } + +// GetCacheGTSInstanceSweepFreq safely fetches the value for global configuration 'Cache.GTS.InstanceSweepFreq' field +func GetCacheGTSInstanceSweepFreq() time.Duration { return global.GetCacheGTSInstanceSweepFreq() } + +// SetCacheGTSInstanceSweepFreq safely sets the value for global configuration 'Cache.GTS.InstanceSweepFreq' field +func SetCacheGTSInstanceSweepFreq(v time.Duration) { global.SetCacheGTSInstanceSweepFreq(v) } + // GetCacheGTSListMaxSize safely fetches the Configuration value for state's 'Cache.GTS.ListMaxSize' field func (st *ConfigState) GetCacheGTSListMaxSize() (v int) { st.mutex.Lock() |