diff options
author | 2023-11-08 14:32:17 +0000 | |
---|---|---|
committer | 2023-11-08 14:32:17 +0000 | |
commit | e9e5dc5a40926e5320cb131b035c46b1e1b0bd59 (patch) | |
tree | 52edc9fa5742f28e1e5223f51cda628ec1c35a24 /internal/config | |
parent | [chore]: Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#2338) (diff) | |
download | gotosocial-e9e5dc5a40926e5320cb131b035c46b1e1b0bd59.tar.xz |
[feature] add support for polls + receiving federated status edits (#2330)
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 3 | ||||
-rw-r--r-- | internal/config/defaults.go | 3 | ||||
-rw-r--r-- | internal/config/gen/gen.go | 2 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 75 |
4 files changed, 82 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 77e70185c..7cb31d0a1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -204,6 +204,9 @@ type CacheConfiguration struct { MediaMemRatio float64 `name:"media-mem-ratio"` MentionMemRatio float64 `name:"mention-mem-ratio"` NotificationMemRatio float64 `name:"notification-mem-ratio"` + PollMemRatio float64 `name:"poll-mem-ratio"` + PollVoteMemRatio float64 `name:"poll-vote-mem-ratio"` + PollVoteIDsMemRatio float64 `name:"poll-vote-ids-mem-ratio"` ReportMemRatio float64 `name:"report-mem-ratio"` StatusMemRatio float64 `name:"status-mem-ratio"` StatusFaveMemRatio float64 `name:"status-fave-mem-ratio"` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index 0c2556e9d..2a7c6f9db 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -171,6 +171,9 @@ var Defaults = Configuration{ MediaMemRatio: 4, MentionMemRatio: 2, NotificationMemRatio: 2, + PollMemRatio: 1, + PollVoteMemRatio: 2, + PollVoteIDsMemRatio: 2, ReportMemRatio: 1, StatusMemRatio: 5, StatusFaveMemRatio: 2, diff --git a/internal/config/gen/gen.go b/internal/config/gen/gen.go index bd7899a78..d9fb30904 100644 --- a/internal/config/gen/gen.go +++ b/internal/config/gen/gen.go @@ -70,7 +70,7 @@ func main() { fmt.Fprint(output, ")\n\n") generateFields(output, nil, reflect.TypeOf(config.Configuration{})) _ = output.Close() - _ = exec.Command("gofumports", "-w", out).Run() + _ = exec.Command("gofumpt", "-w", out).Run() // The plan here is that eventually we might be able // to generate an example configuration from struct tags diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 415035bea..6e9b71812 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -3099,6 +3099,81 @@ func GetCacheNotificationMemRatio() float64 { return global.GetCacheNotification // SetCacheNotificationMemRatio safely sets the value for global configuration 'Cache.NotificationMemRatio' field func SetCacheNotificationMemRatio(v float64) { global.SetCacheNotificationMemRatio(v) } +// GetCachePollMemRatio safely fetches the Configuration value for state's 'Cache.PollMemRatio' field +func (st *ConfigState) GetCachePollMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.PollMemRatio + st.mutex.RUnlock() + return +} + +// SetCachePollMemRatio safely sets the Configuration value for state's 'Cache.PollMemRatio' field +func (st *ConfigState) SetCachePollMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.PollMemRatio = v + st.reloadToViper() +} + +// CachePollMemRatioFlag returns the flag name for the 'Cache.PollMemRatio' field +func CachePollMemRatioFlag() string { return "cache-poll-mem-ratio" } + +// GetCachePollMemRatio safely fetches the value for global configuration 'Cache.PollMemRatio' field +func GetCachePollMemRatio() float64 { return global.GetCachePollMemRatio() } + +// SetCachePollMemRatio safely sets the value for global configuration 'Cache.PollMemRatio' field +func SetCachePollMemRatio(v float64) { global.SetCachePollMemRatio(v) } + +// GetCachePollVoteMemRatio safely fetches the Configuration value for state's 'Cache.PollVoteMemRatio' field +func (st *ConfigState) GetCachePollVoteMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.PollVoteMemRatio + st.mutex.RUnlock() + return +} + +// SetCachePollVoteMemRatio safely sets the Configuration value for state's 'Cache.PollVoteMemRatio' field +func (st *ConfigState) SetCachePollVoteMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.PollVoteMemRatio = v + st.reloadToViper() +} + +// CachePollVoteMemRatioFlag returns the flag name for the 'Cache.PollVoteMemRatio' field +func CachePollVoteMemRatioFlag() string { return "cache-poll-vote-mem-ratio" } + +// GetCachePollVoteMemRatio safely fetches the value for global configuration 'Cache.PollVoteMemRatio' field +func GetCachePollVoteMemRatio() float64 { return global.GetCachePollVoteMemRatio() } + +// SetCachePollVoteMemRatio safely sets the value for global configuration 'Cache.PollVoteMemRatio' field +func SetCachePollVoteMemRatio(v float64) { global.SetCachePollVoteMemRatio(v) } + +// GetCachePollVoteIDsMemRatio safely fetches the Configuration value for state's 'Cache.PollVoteIDsMemRatio' field +func (st *ConfigState) GetCachePollVoteIDsMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.PollVoteIDsMemRatio + st.mutex.RUnlock() + return +} + +// SetCachePollVoteIDsMemRatio safely sets the Configuration value for state's 'Cache.PollVoteIDsMemRatio' field +func (st *ConfigState) SetCachePollVoteIDsMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.PollVoteIDsMemRatio = v + st.reloadToViper() +} + +// CachePollVoteIDsMemRatioFlag returns the flag name for the 'Cache.PollVoteIDsMemRatio' field +func CachePollVoteIDsMemRatioFlag() string { return "cache-poll-vote-ids-mem-ratio" } + +// GetCachePollVoteIDsMemRatio safely fetches the value for global configuration 'Cache.PollVoteIDsMemRatio' field +func GetCachePollVoteIDsMemRatio() float64 { return global.GetCachePollVoteIDsMemRatio() } + +// SetCachePollVoteIDsMemRatio safely sets the value for global configuration 'Cache.PollVoteIDsMemRatio' field +func SetCachePollVoteIDsMemRatio(v float64) { global.SetCachePollVoteIDsMemRatio(v) } + // GetCacheReportMemRatio safely fetches the Configuration value for state's 'Cache.ReportMemRatio' field func (st *ConfigState) GetCacheReportMemRatio() (v float64) { st.mutex.RLock() |