You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mastodon/app/controllers/api/v1
Akihiko Odaki 552e886b64
Eagerly load statuses with the main query in Api::V1::FavouritesController (#14673)
The old implementation had two queries:
1. The query constructed in Api::V1::FavouritesController#results
2. The query constructed in #cached_favourites, which is merged with 1.

Both of them are issued againt PostgreSQL. The combination of the two
queries caused the following problems:
- The small window between the two queries involves race conditions.
- Minor performance inefficiency.

Moreover, the construction of query 2, which involves merging with query
1 has a bug. Query 1 is finalized with paginate_by_id, but paginate_by_id
returns an array when min_id parameter is specified. The behavior prevents
from merging the query, and in the real world, ActiveRecord simply ignores
the merge (!), which results in querying the entire scan of statuses and
favourites table.

This change fixes these issues by simply letting query 1 get all the works
done.
5 years ago
..
accounts Add user notes on accounts (#14148) 5 years ago
admin Change deletes to preserve soft-deleted statuses in unresolved reports (#11805) 6 years ago
announcements Add announcements (#12662) 5 years ago
apps Remove useless `respond_to` calls (#13208) 5 years ago
crypto Fix wrong route helper in encrypted messages controller (#13952) 5 years ago
featured_tags Remove useless `respond_to` calls (#13208) 5 years ago
instances Remove useless `respond_to` calls (#13208) 5 years ago
lists
polls Add more tests for ActivityPub controllers (#13585) 5 years ago
push Add more tests for ActivityPub controllers (#13585) 5 years ago
statuses Fix not being able to unbookmark toots when blocked by their author (#14604) 5 years ago
timelines Use Status.group instead of Status.distinct in HashQueryService (#14662) 5 years ago
accounts_controller.rb Add specific rate limits for posting and following (#13172) 5 years ago
announcements_controller.rb Fix dismissing an announcement twice raising an obscure error (#13124) 5 years ago
apps_controller.rb Add whitelist mode (#11291) 6 years ago
blocks_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
bookmarks_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
conversations_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
custom_emojis_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
directories_controller.rb Add profile directory to web UI (#11688) 6 years ago
domain_blocks_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
endorsements_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
favourites_controller.rb Eagerly load statuses with the main query in Api::V1::FavouritesController (#14673) 5 years ago
featured_tags_controller.rb Add featured tags API (#11778) 6 years ago
filters_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
follow_requests_controller.rb Add updated relationship to follow request API responses (#11800) 6 years ago
instances_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
lists_controller.rb
markers_controller.rb Add timeline read markers API (#11762) 6 years ago
media_controller.rb Add customizable thumbnails for audio and video attachments (#14145) 5 years ago
mutes_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
notifications_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
polls_controller.rb Add more tests for ActivityPub controllers (#13585) 5 years ago
preferences_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
reports_controller.rb Add rate limit for reporting (#13390) 5 years ago
scheduled_statuses_controller.rb
statuses_controller.rb Fix/14021 behaviour on add or remove toots (#14212) 5 years ago
streaming_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
suggestions_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
trends_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago