Added 10k limit to resource queries

refs https://github.com/TryGhost/Team/issues/1665

- When requesting 'all' resource the search could experience significant performance degradation and would be unresponsive when there are large amounts of posts/tags/authors on the site
- The limit of 10 000 records was chosen as a stopgap solution for experiments in live environment. Once we verify this limit is not causing much trouble, we could increase it if neede
This commit is contained in:
Naz 2022-07-07 12:58:41 +02:00
parent ec68dc303c
commit 089edbc39c

View File

@ -55,7 +55,7 @@ export default class SearchIndex {
async init() { async init() {
let posts = await this.api.posts.browse({ let posts = await this.api.posts.browse({
limit: 'all', limit: '10000',
fields: 'id,slug,title,excerpt,url,updated_at,visibility', fields: 'id,slug,title,excerpt,url,updated_at,visibility',
order: 'updated_at DESC' order: 'updated_at DESC'
}); });
@ -68,8 +68,9 @@ export default class SearchIndex {
} }
let authors = await this.api.authors.browse({ let authors = await this.api.authors.browse({
limit: 'all', limit: '10000',
fields: 'id,slug,name,url,profile_image' fields: 'id,slug,name,url,profile_image',
order: 'updated_at DESC'
}); });
if (authors || authors.length > 0) { if (authors || authors.length > 0) {
@ -81,8 +82,9 @@ export default class SearchIndex {
} }
let tags = await this.api.tags.browse({ let tags = await this.api.tags.browse({
limit: 'all', limit: '10000',
fields: 'id,slug,name,url' fields: 'id,slug,name,url',
order: 'updated_at DESC'
}); });
if (tags || tags.length > 0) { if (tags || tags.length > 0) {