This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
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.
2020-08-28 09:27:33 +02:00
..
accounts Add user notes on accounts (#14148) 2020-06-30 19:19:50 +02:00
admin Change deletes to preserve soft-deleted statuses in unresolved reports (#11805) 2019-09-11 16:32:44 +02:00
announcements Add announcements (#12662) 2020-01-23 22:00:13 +01:00
apps Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
crypto Fix wrong route helper in encrypted messages controller (#13952) 2020-06-03 20:32:15 +02:00
featured_tags Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
instances Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
lists
polls Add more tests for ActivityPub controllers (#13585) 2020-05-03 16:30:36 +02:00
push Add more tests for ActivityPub controllers (#13585) 2020-05-03 16:30:36 +02:00
statuses Fix not being able to unbookmark toots when blocked by their author (#14604) 2020-08-19 19:02:06 +02:00
timelines Use Status.group instead of Status.distinct in HashQueryService (#14662) 2020-08-25 13:39:35 +02:00
accounts_controller.rb Add specific rate limits for posting and following (#13172) 2020-03-08 15:17:39 +01:00
announcements_controller.rb Fix dismissing an announcement twice raising an obscure error (#13124) 2020-02-24 22:21:40 +01:00
apps_controller.rb
blocks_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
bookmarks_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
conversations_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
custom_emojis_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
directories_controller.rb
domain_blocks_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
endorsements_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
favourites_controller.rb Eagerly load statuses with the main query in Api::V1::FavouritesController (#14673) 2020-08-28 09:27:33 +02:00
featured_tags_controller.rb Add featured tags API (#11778) 2019-09-09 10:50:33 +02:00
filters_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
follow_requests_controller.rb Add updated relationship to follow request API responses (#11800) 2019-09-10 20:56:42 +02:00
instances_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
lists_controller.rb
markers_controller.rb
media_controller.rb Add customizable thumbnails for audio and video attachments (#14145) 2020-06-29 13:56:55 +02:00
mutes_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
notifications_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
polls_controller.rb Add more tests for ActivityPub controllers (#13585) 2020-05-03 16:30:36 +02:00
preferences_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
reports_controller.rb Add rate limit for reporting (#13390) 2020-04-05 14:40:08 +02:00
scheduled_statuses_controller.rb
statuses_controller.rb Fix/14021 behaviour on add or remove toots (#14212) 2020-07-19 17:04:02 +02:00
streaming_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
suggestions_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00
trends_controller.rb Remove useless `respond_to` calls (#13208) 2020-03-06 01:29:38 +01:00