diff options
| author | 2025-10-15 13:32:02 +0200 | |
|---|---|---|
| committer | 2025-10-17 15:33:35 +0200 | |
| commit | 2bdff66f0a12a16684e5d25bcace551446ec1c78 (patch) | |
| tree | 4a667a71f97d6d2d52d5b3dae1e56d74192219b3 /internal/config/helpers.gen.go | |
| parent | [chore/performance] Use CTE for list select statuses query (#4501) (diff) | |
| download | gotosocial-2bdff66f0a12a16684e5d25bcace551446ec1c78.tar.xz | |
[performance] cache account IDs in home timeline query not in exclusive lists (#4502)
this caches the stage of the home timeline query in which we calculate which account IDs should be shown in a particular user's timeline.
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4502
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/config/helpers.gen.go')
| -rw-r--r-- | internal/config/helpers.gen.go | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index d54d72b53..217917bcf 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -179,6 +179,7 @@ const ( CacheFollowRequestMemRatioFlag = "cache-follow-request-mem-ratio" CacheFollowRequestIDsMemRatioFlag = "cache-follow-request-ids-mem-ratio" CacheFollowingTagIDsMemRatioFlag = "cache-following-tag-ids-mem-ratio" + CacheHomeAccountIDsMemRatioFlag = "cache-home-account-ids-mem-ratio" CacheInReplyToIDsMemRatioFlag = "cache-in-reply-to-ids-mem-ratio" CacheInstanceMemRatioFlag = "cache-instance-mem-ratio" CacheInteractionRequestMemRatioFlag = "cache-interaction-request-mem-ratio" @@ -377,6 +378,7 @@ func (cfg *Configuration) RegisterFlags(flags *pflag.FlagSet) { flags.Float64("cache-follow-request-mem-ratio", cfg.Cache.FollowRequestMemRatio, "") flags.Float64("cache-follow-request-ids-mem-ratio", cfg.Cache.FollowRequestIDsMemRatio, "") flags.Float64("cache-following-tag-ids-mem-ratio", cfg.Cache.FollowingTagIDsMemRatio, "") + flags.Float64("cache-home-account-ids-mem-ratio", cfg.Cache.HomeAccountIDsMemRatio, "") flags.Float64("cache-in-reply-to-ids-mem-ratio", cfg.Cache.InReplyToIDsMemRatio, "") flags.Float64("cache-instance-mem-ratio", cfg.Cache.InstanceMemRatio, "") flags.Float64("cache-interaction-request-mem-ratio", cfg.Cache.InteractionRequestMemRatio, "") @@ -416,7 +418,7 @@ func (cfg *Configuration) RegisterFlags(flags *pflag.FlagSet) { } func (cfg *Configuration) MarshalMap() map[string]any { - cfgmap := make(map[string]any, 195) + cfgmap := make(map[string]any, 196) cfgmap["log-level"] = cfg.LogLevel cfgmap["log-format"] = cfg.LogFormat cfgmap["log-timestamp-format"] = cfg.LogTimestampFormat @@ -567,6 +569,7 @@ func (cfg *Configuration) MarshalMap() map[string]any { cfgmap["cache-follow-request-mem-ratio"] = cfg.Cache.FollowRequestMemRatio cfgmap["cache-follow-request-ids-mem-ratio"] = cfg.Cache.FollowRequestIDsMemRatio cfgmap["cache-following-tag-ids-mem-ratio"] = cfg.Cache.FollowingTagIDsMemRatio + cfgmap["cache-home-account-ids-mem-ratio"] = cfg.Cache.HomeAccountIDsMemRatio cfgmap["cache-in-reply-to-ids-mem-ratio"] = cfg.Cache.InReplyToIDsMemRatio cfgmap["cache-instance-mem-ratio"] = cfg.Cache.InstanceMemRatio cfgmap["cache-interaction-request-mem-ratio"] = cfg.Cache.InteractionRequestMemRatio @@ -1855,6 +1858,14 @@ func (cfg *Configuration) UnmarshalMap(cfgmap map[string]any) error { } } + if ival, ok := cfgmap["cache-home-account-ids-mem-ratio"]; ok { + var err error + cfg.Cache.HomeAccountIDsMemRatio, err = cast.ToFloat64E(ival) + if err != nil { + return fmt.Errorf("error casting %#v -> float64 for 'cache-home-account-ids-mem-ratio': %w", ival, err) + } + } + if ival, ok := cfgmap["cache-in-reply-to-ids-mem-ratio"]; ok { var err error cfg.Cache.InReplyToIDsMemRatio, err = cast.ToFloat64E(ival) @@ -5536,6 +5547,28 @@ func GetCacheFollowingTagIDsMemRatio() float64 { return global.GetCacheFollowing // SetCacheFollowingTagIDsMemRatio safely sets the value for global configuration 'Cache.FollowingTagIDsMemRatio' field func SetCacheFollowingTagIDsMemRatio(v float64) { global.SetCacheFollowingTagIDsMemRatio(v) } +// GetCacheHomeAccountIDsMemRatio safely fetches the Configuration value for state's 'Cache.HomeAccountIDsMemRatio' field +func (st *ConfigState) GetCacheHomeAccountIDsMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.HomeAccountIDsMemRatio + st.mutex.RUnlock() + return v +} + +// SetCacheHomeAccountIDsMemRatio safely sets the Configuration value for state's 'Cache.HomeAccountIDsMemRatio' field +func (st *ConfigState) SetCacheHomeAccountIDsMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.HomeAccountIDsMemRatio = v + st.reloadToViper() +} + +// GetCacheHomeAccountIDsMemRatio safely fetches the value for global configuration 'Cache.HomeAccountIDsMemRatio' field +func GetCacheHomeAccountIDsMemRatio() float64 { return global.GetCacheHomeAccountIDsMemRatio() } + +// SetCacheHomeAccountIDsMemRatio safely sets the value for global configuration 'Cache.HomeAccountIDsMemRatio' field +func SetCacheHomeAccountIDsMemRatio(v float64) { global.SetCacheHomeAccountIDsMemRatio(v) } + // GetCacheInReplyToIDsMemRatio safely fetches the Configuration value for state's 'Cache.InReplyToIDsMemRatio' field func (st *ConfigState) GetCacheInReplyToIDsMemRatio() (v float64) { st.mutex.RLock() @@ -6559,6 +6592,7 @@ func (st *ConfigState) GetTotalOfMemRatios() (total float64) { total += st.config.Cache.FollowRequestMemRatio total += st.config.Cache.FollowRequestIDsMemRatio total += st.config.Cache.FollowingTagIDsMemRatio + total += st.config.Cache.HomeAccountIDsMemRatio total += st.config.Cache.InReplyToIDsMemRatio total += st.config.Cache.InstanceMemRatio total += st.config.Cache.InteractionRequestMemRatio @@ -7170,6 +7204,17 @@ func flattenConfigMap(cfgmap map[string]any) { } for _, key := range [][]string{ + {"cache", "home-account-ids-mem-ratio"}, + } { + ival, ok := mapGet(cfgmap, key...) + if ok { + cfgmap["cache-home-account-ids-mem-ratio"] = ival + nestedKeys[key[0]] = struct{}{} + break + } + } + + for _, key := range [][]string{ {"cache", "in-reply-to-ids-mem-ratio"}, } { ival, ok := mapGet(cfgmap, key...) |
