summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-10-13 14:03:17 +0200
committerLibravatar tobi <tobi.smethurst@protonmail.com>2025-10-17 15:32:50 +0200
commit3a5119b5ff2c8f6ecb02d4054002b3845ca05e9c (patch)
tree39a16e66ea60f6bd46a3d75e6da0c73b2705c118 /internal
parent[performance] add benchmarks for native Go imaging code, small tweaks to redu... (diff)
downloadgotosocial-3a5119b5ff2c8f6ecb02d4054002b3845ca05e9c.tar.xz
[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 <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/cache/timeline/status.go10
1 files changed, 10 insertions, 0 deletions
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) {