Skip to content

Commit

Permalink
Fix N+1 problem on statuses/public_statuses indices
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Sep 16, 2023
1 parent 0ffd8ac commit 6aaef5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/chewy/public_statuses_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class PublicStatusesIndex < Chewy::Index
index_scope ::Status.unscoped
.kept
.indexable
.includes(:media_attachments, :preloadable_poll, :preview_cards, :tags)
.includes(:media_attachments, :preloadable_poll, :preview_cards, :tags, :account)

root date_detection: false do
field(:id, type: 'long')
Expand Down
1 change: 1 addition & 0 deletions app/chewy/statuses_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class StatusesIndex < Chewy::Index
settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: Rails.env.test? ? DEVELOPMENT_SETTINGS : PRODUCTION_SETTINGS

index_scope ::Status.unscoped.kept.without_reblogs.includes(
:account,
:media_attachments,
:preview_cards,
:local_mentioned,
Expand Down

0 comments on commit 6aaef5c

Please sign in to comment.