gitlab-org--gitlab-foss/spec/finders
Yorick Peterse 237c8f66e6
Precalculate trending projects
This commit introduces a Sidekiq worker that precalculates the list of
trending projects on a daily basis. The resulting set is stored in a
database table that is then queried by Project.trending.

This setup means that Unicorn workers no longer _may_ have to calculate
the list of trending projects. Furthermore it supports filtering without
any complex caching mechanisms.

The data in the "trending_projects" table is inserted in the same order
as the project ranking. This means that getting the projects in the
correct order is simply a matter of:

    SELECT projects.*
    FROM projects
    INNER JOIN trending_projects ON trending_projects.project_id = projects.id
    ORDER BY trending_projects.id ASC;

Such a query will only take a few milliseconds at most (as measured on
GitLab.com), opposed to a few seconds for the query used for calculating
the project ranks.

The migration in this commit does not require downtime and takes care of
populating an initial list of trending projects.
2016-10-10 12:27:08 +02:00
..
access_requests_finder_spec.rb
branches_finder_spec.rb
contributed_projects_finder_spec.rb Align hash literals to keep Rubocop happy 2015-11-18 13:27:03 +01:00
group_projects_finder_spec.rb
groups_finder_spec.rb
issues_finder_spec.rb fix issues mr counter 2016-09-20 14:39:15 +01:00
joined_groups_finder_spec.rb Allow Member.add_user to handle access requesters 2016-09-28 09:43:00 +02:00
merge_requests_finder_spec.rb
move_to_project_finder_spec.rb Move to project dropdown with infinite scroll for better performance 2016-08-18 15:31:51 +02:00
notes_finder_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
personal_projects_finder_spec.rb
pipelines_finder_spec.rb Improve PipelinesFinder spec so that it does not depend on hard-coded database IDs 2016-09-09 16:21:46 -04:00
projects_finder_spec.rb Allow Member.add_user to handle access requesters 2016-09-28 09:43:00 +02:00
snippets_finder_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
tags_finder_spec.rb
todos_finder_spec.rb Todos sorting dropdown 2016-08-19 16:14:20 -03:00