From 4f2aa792b33fdd5fb4b22dec813b3668d7190522 Mon Sep 17 00:00:00 2001 From: kim Date: Tue, 1 Jul 2025 16:00:04 +0200 Subject: [performance] add statusfilter cache to cache calculated status filtering results (#4303) this adds another 'filter' type cache, similar to the visibility and mute caches, to cache the results of status filtering checks. for the moment this keeps all the check calls themselves within the frontend typeconversion code, but i may move this out of the typeconverter in a future PR (also removing the ErrHideStatus means of propagating a hidden status). also tweaks some of the cache invalidation hooks to not make unnecessary calls. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4303 Co-authored-by: kim Co-committed-by: kim --- internal/processing/common/status.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'internal/processing/common') diff --git a/internal/processing/common/status.go b/internal/processing/common/status.go index 83acddc84..f5f230e98 100644 --- a/internal/processing/common/status.go +++ b/internal/processing/common/status.go @@ -24,10 +24,10 @@ import ( apimodel "code.superseriousbusiness.org/gotosocial/internal/api/model" "code.superseriousbusiness.org/gotosocial/internal/db" "code.superseriousbusiness.org/gotosocial/internal/federation/dereferencing" - statusfilter "code.superseriousbusiness.org/gotosocial/internal/filter/status" "code.superseriousbusiness.org/gotosocial/internal/gtserror" "code.superseriousbusiness.org/gotosocial/internal/gtsmodel" "code.superseriousbusiness.org/gotosocial/internal/log" + "code.superseriousbusiness.org/gotosocial/internal/typeutils" ) // GetOwnStatus fetches the given status with ID, @@ -214,7 +214,6 @@ func (p *Processor) GetAPIStatus( target, requester, gtsmodel.FilterContextNone, - nil, ) if err != nil { err := gtserror.Newf("error converting: %w", err) @@ -235,7 +234,6 @@ func (p *Processor) GetVisibleAPIStatuses( requester *gtsmodel.Account, statuses []*gtsmodel.Status, filterCtx gtsmodel.FilterContext, - filters []*gtsmodel.Filter, ) []apimodel.Status { // Start new log entry with @@ -278,9 +276,8 @@ func (p *Processor) GetVisibleAPIStatuses( status, requester, filterCtx, - filters, ) - if err != nil && !errors.Is(err, statusfilter.ErrHideStatus) { + if err != nil && !errors.Is(err, typeutils.ErrHideStatus) { l.Errorf("error converting: %v", err) continue } -- cgit v1.2.3