mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-21 16:27:31 -06:00
add logic to allow dynamic clear / preloading of timelines
This commit is contained in:
parent
b04b4f8516
commit
83f6685437
5 changed files with 318 additions and 222 deletions
|
|
@ -29,7 +29,6 @@ import (
|
|||
statusfilter "github.com/superseriousbusiness/gotosocial/internal/filter/status"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/filter/usermute"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtscontext"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/id"
|
||||
|
|
@ -62,44 +61,6 @@ func New(state *state.State, converter *typeutils.Converter, visFilter *visibili
|
|||
}
|
||||
}
|
||||
|
||||
// Preload ...
|
||||
func (p *Processor) Preload(ctx context.Context) error {
|
||||
|
||||
// Get all of our local user accounts.
|
||||
users, err := p.state.DB.GetAllUsers(ctx)
|
||||
if err != nil {
|
||||
return gtserror.Newf("error getting users: %w", err)
|
||||
}
|
||||
|
||||
for _, user := range users {
|
||||
// Get associated account.
|
||||
account := user.Account
|
||||
|
||||
// Preload this user account's home timeline cache.
|
||||
if err := p.preloadHomeTimeline(ctx, account); err != nil {
|
||||
return gtserror.Newf("error preloading home timeline: %w", err)
|
||||
}
|
||||
|
||||
// Get all lists owned by this user account.
|
||||
lists, err := p.state.DB.GetListsByAccountID(
|
||||
gtscontext.SetBarebones(ctx),
|
||||
account.ID,
|
||||
)
|
||||
if err != nil {
|
||||
return gtserror.Newf("error getting account %s lists: %w", account.ID, err)
|
||||
}
|
||||
|
||||
for _, list := range lists {
|
||||
// Preload each of this user account's list timeline caches.
|
||||
if err := p.preloadListTimeline(ctx, account, list); err != nil {
|
||||
return gtserror.Newf("error preloading list timeline: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Processor) getStatusTimeline(
|
||||
ctx context.Context,
|
||||
requester *gtsmodel.Account,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue