From 3a5119b5ff2c8f6ecb02d4054002b3845ca05e9c Mon Sep 17 00:00:00 2001 From: kim Date: Mon, 13 Oct 2025 14:03:17 +0200 Subject: [bugfix] repeated posts on timeline endpoints (#4494) - updates the go-structr library to add support for getting the current HEAD and TAIL primary key values, which allows us to not insert statuses if they're older than the current oldest timeline item - ensures the nextPg parameters get updated after loading from the cache before then performing a database query closes: https://codeberg.org/superseriousbusiness/gotosocial/issues/4491 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4494 Co-authored-by: kim Co-committed-by: kim --- internal/cache/timeline/status.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'internal/cache/timeline/status.go') diff --git a/internal/cache/timeline/status.go b/internal/cache/timeline/status.go index 7e6d3aa27..9e3957ac2 100644 --- a/internal/cache/timeline/status.go +++ b/internal/cache/timeline/status.go @@ -387,6 +387,9 @@ func (t *StatusTimeline) Load( return nil, "", "", gtserror.Newf("error loading statuses: %w", err) } + // Update nextPg cursor parameter for database query. + nextPageParams(nextPg, metas[len(metas)-1].ID, order) + // Prepare frontend API models for // the cached statuses. For now this // also does its own extra filtering. @@ -536,6 +539,13 @@ func (t *StatusTimeline) InsertOne(status *gtsmodel.Status, prepared *apimodel.S return false } + // If item is beyond end of the + // timeline, don't bother adding. + if tailID := t.cache.Tail(); // + tailID == nil || status.ID < *tailID { + return false + } + if status.BoostOfID != "" { // Check through top $repeatBoostDepth number of items. for i, value := range t.cache.RangeUnsafe(structr.Desc) { -- cgit v1.2.3