FIX: Ensure sitemaps include all topics with no duplicates (#26289)

We were using `OFFSET`/`LIMIT` to query topics without an 'ORDER'. Without an explicit order, postgres makes no guarantees about which rows will be returned for each query. This commit adds `ORDER BY id ASC` so that our sitemaps behave consistently.
This commit is contained in:
David Taylor 2024-03-21 13:19:53 +00:00 committed by GitHub
parent 284b65e165
commit 4e082c7390
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ class Sitemap < ActiveRecord::Base
else
offset = (name.to_i - 1) * max_page_size
indexable_topics.limit(max_page_size).offset(offset)
indexable_topics.order(id: :asc).limit(max_page_size).offset(offset)
end
end
end