comment-out unused functions, but leave in place as we might end-up using them

This commit is contained in:
kim 2025-04-08 16:40:27 +01:00
commit b026299b46
2 changed files with 49 additions and 51 deletions

View file

@ -25,7 +25,6 @@ import (
statusfilter "github.com/superseriousbusiness/gotosocial/internal/filter/status" statusfilter "github.com/superseriousbusiness/gotosocial/internal/filter/status"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/log"
"github.com/superseriousbusiness/gotosocial/internal/paging" "github.com/superseriousbusiness/gotosocial/internal/paging"
) )
@ -94,32 +93,32 @@ func (p *Processor) HomeTimelineGet(
// preloadHomeTimeline will ensure that the timeline // preloadHomeTimeline will ensure that the timeline
// cache for home owned by given account is preloaded. // cache for home owned by given account is preloaded.
func (p *Processor) preloadHomeTimeline( // func (p *Processor) preloadHomeTimeline(
ctx context.Context, // ctx context.Context,
account *gtsmodel.Account, // account *gtsmodel.Account,
) error { // ) error {
// Get (and so, create) home timeline cache for account ID. // // Get (and so, create) home timeline cache for account ID.
timeline := p.state.Caches.Timelines.Home.MustGet(account.ID) // timeline := p.state.Caches.Timelines.Home.MustGet(account.ID)
// Preload timeline with funcs. // // Preload timeline with funcs.
n, err := timeline.Preload(ctx, // n, err := timeline.Preload(ctx,
// Database load function. // // Database load function.
func(page *paging.Page) ([]*gtsmodel.Status, error) { // func(page *paging.Page) ([]*gtsmodel.Status, error) {
return p.state.DB.GetHomeTimeline(ctx, account.ID, page) // return p.state.DB.GetHomeTimeline(ctx, account.ID, page)
}, // },
// Status filtering function. // // Status filtering function.
func(status *gtsmodel.Status) (bool, error) { // func(status *gtsmodel.Status) (bool, error) {
ok, err := p.visFilter.StatusHomeTimelineable(ctx, account, status) // ok, err := p.visFilter.StatusHomeTimelineable(ctx, account, status)
return !ok, err // return !ok, err
}, // },
) // )
if err != nil { // if err != nil {
return gtserror.Newf("error preloading home timeline %s: %w", account.ID, err) // return gtserror.Newf("error preloading home timeline %s: %w", account.ID, err)
} // }
log.Infof(ctx, "%s: preloaded %d", account.Username, n) // log.Infof(ctx, "%s: preloaded %d", account.Username, n)
return nil // return nil
} // }

View file

@ -27,7 +27,6 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/gtscontext" "github.com/superseriousbusiness/gotosocial/internal/gtscontext"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/log"
"github.com/superseriousbusiness/gotosocial/internal/paging" "github.com/superseriousbusiness/gotosocial/internal/paging"
) )
@ -107,33 +106,33 @@ func (p *Processor) ListTimelineGet(
// preloadListTimeline will ensure that the timeline // preloadListTimeline will ensure that the timeline
// cache for list owned by given account is preloaded. // cache for list owned by given account is preloaded.
func (p *Processor) preloadListTimeline( // func (p *Processor) preloadListTimeline(
ctx context.Context, // ctx context.Context,
account *gtsmodel.Account, // account *gtsmodel.Account,
list *gtsmodel.List, // list *gtsmodel.List,
) error { // ) error {
// Get (and so, create) list timeline cache for list ID. // // Get (and so, create) list timeline cache for list ID.
timeline := p.state.Caches.Timelines.List.MustGet(list.ID) // timeline := p.state.Caches.Timelines.List.MustGet(list.ID)
// Preload timeline with funcs. // // Preload timeline with funcs.
n, err := timeline.Preload(ctx, // n, err := timeline.Preload(ctx,
// Database load function. // // Database load function.
func(page *paging.Page) ([]*gtsmodel.Status, error) { // func(page *paging.Page) ([]*gtsmodel.Status, error) {
return p.state.DB.GetListTimeline(ctx, list.ID, page) // return p.state.DB.GetListTimeline(ctx, list.ID, page)
}, // },
// Status filtering function. // // Status filtering function.
func(status *gtsmodel.Status) (bool, error) { // func(status *gtsmodel.Status) (bool, error) {
ok, err := p.visFilter.StatusHomeTimelineable(ctx, account, status) // ok, err := p.visFilter.StatusHomeTimelineable(ctx, account, status)
return !ok, err // return !ok, err
}, // },
) // )
if err != nil { // if err != nil {
return gtserror.Newf("error preloading list timeline %s: %w", list.ID, err) // return gtserror.Newf("error preloading list timeline %s: %w", list.ID, err)
} // }
log.Infof(ctx, "%s[%q]: preloaded %d", account.Username, list.Title, n) // log.Infof(ctx, "%s[%q]: preloaded %d", account.Username, list.Title, n)
return nil // return nil
} // }