mirror of
https://github.com/kikobar/mastodon.git
synced 2024-12-28 00:34:16 +00:00
552e886b64
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. |
||
---|---|---|
.. | ||
accounts | ||
admin | ||
announcements | ||
apps | ||
crypto | ||
featured_tags | ||
instances | ||
lists | ||
polls | ||
push | ||
statuses | ||
timelines | ||
accounts_controller.rb | ||
announcements_controller.rb | ||
apps_controller.rb | ||
blocks_controller.rb | ||
bookmarks_controller.rb | ||
conversations_controller.rb | ||
custom_emojis_controller.rb | ||
directories_controller.rb | ||
domain_blocks_controller.rb | ||
endorsements_controller.rb | ||
favourites_controller.rb | ||
featured_tags_controller.rb | ||
filters_controller.rb | ||
follow_requests_controller.rb | ||
instances_controller.rb | ||
lists_controller.rb | ||
markers_controller.rb | ||
media_controller.rb | ||
mutes_controller.rb | ||
notifications_controller.rb | ||
polls_controller.rb | ||
preferences_controller.rb | ||
reports_controller.rb | ||
scheduled_statuses_controller.rb | ||
statuses_controller.rb | ||
streaming_controller.rb | ||
suggestions_controller.rb | ||
trends_controller.rb |