diff options
Diffstat (limited to 'internal/timeline/manager.go')
-rw-r--r-- | internal/timeline/manager.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/timeline/manager.go b/internal/timeline/manager.go index b70e6cf82..95a40aca1 100644 --- a/internal/timeline/manager.go +++ b/internal/timeline/manager.go @@ -19,7 +19,6 @@ package timeline import ( "context" - "fmt" "sync" "time" @@ -76,6 +75,9 @@ type Manager interface { // WipeStatusesFromAccountID removes all items by the given accountID from the given timeline. WipeItemsFromAccountID(ctx context.Context, timelineID string, accountID string) error + // Prune manually triggers a prune operation for the given timelineID. + Prune(ctx context.Context, timelineID string, desiredPreparedItemsLength int, desiredIndexedItemsLength int) (int, error) + // Start starts hourly cleanup jobs for this timeline manager. Start() error @@ -191,7 +193,7 @@ func (m *manager) WipeItemFromAllTimelines(ctx context.Context, itemID string) e }) if len(errors) > 0 { - return fmt.Errorf("WipeItemFromAllTimelines: one or more errors wiping status %s: %w", itemID, errors.Combine()) + return gtserror.Newf("one or more errors wiping status %s: %w", itemID, errors.Combine()) } return nil @@ -202,6 +204,10 @@ func (m *manager) WipeItemsFromAccountID(ctx context.Context, timelineID string, return err } +func (m *manager) Prune(ctx context.Context, timelineID string, desiredPreparedItemsLength int, desiredIndexedItemsLength int) (int, error) { + return m.getOrCreateTimeline(ctx, timelineID).Prune(desiredPreparedItemsLength, desiredIndexedItemsLength), nil +} + // getOrCreateTimeline returns a timeline with the given id, // creating a new timeline with that id if necessary. func (m *manager) getOrCreateTimeline(ctx context.Context, timelineID string) Timeline { |