Commit Graph

22 Commits

Author SHA1 Message Date
Eric Eastwood 6fbf24af27 Fix /explore sorting (trending)
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/27044
2017-01-26 12:01:06 -06:00
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
Yorick Peterse 154253cab5
Refactor TrendingProjectsFinder to support caching
== Public Projects

This finder class now _only_ returns public projects. Previously this
finder would also return private and internal projects. Including these
projects makes caching data much harder and less efficient. Meanwhile
including this data isn't very useful as very few users would be
interested in seeing projects they have access to as trending. That is,
the feature is more useful when you want to see what _other_ popular
projects there are.

== Caching

The data returned by TrendingProjectsFinder is now cached for a day
based on the number of months the data should be restricted to. The
cache is not flushed explicitly, instead it's rebuilt whenever it
expires.

== Timings

To measure the impact I changed the finder code to use the last 24
months instead of the last month. I then executed and measured 10
requests to the explore page. On the current "master" branch (commit
88fa5916ff) this would take an average of
2.43 seconds. Using the changes of this commit this was reduced to
around 1.7 seconds.

Fixes gitlab-org/gitlab-ce#22164
2016-10-05 16:39:03 +02:00
Robert Speicher 085538c2bd Use the configured Kaminari "per page" default 2016-03-19 17:37:54 -04:00
Josh Frye 449954ecc2 Allow filtered dashboard/explore results to be paged. Fixes #14104 2016-03-09 21:03:28 -05:00
Dmitriy Zaporozhets acb211215c Add option to show archived projects on dahsboard
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-03-04 19:25:28 +01:00
Josh Frye 120dca0f35 MR feedback 2016-02-09 10:10:41 -05:00
Josh Frye 8b4e9720d9 Extract events rendering to own action. 2016-02-09 10:10:41 -05:00
Josh Frye 30e022a2fe Starred, All, and Trending on explore are paged also group projects. Need ajax filter. 2016-02-09 10:10:41 -05:00
Josh Frye 3f1bd844f1 Implement changes from MR feedback 2016-02-04 14:02:19 -05:00
Josh Frye 2ad094132d Various filter fixes 2016-02-04 13:03:41 -05:00
Josh Frye 7522ac0b3c Paginate + ajax filter dashboard projects 2016-02-04 11:40:19 -05:00
Douwe Maan 5d785457db Clean up overlap between dashboard and explore.
- Split up SnippetsController into separate dashboard and explore sections.
- Use consistent page titles, header titles and sidebars between dashboard and explore sections when signed in or not.
2015-09-08 14:49:20 +01:00
Artem Sidorenko 3ebbed25f0 Allow listing of archived projects
Resolves #9285
2015-08-19 13:46:59 +02:00
Douwe Maan 26ad250989 Add a page title to every page. 2015-04-30 19:12:15 +02:00
Jeroen van Baarsen 5a4ebfb47a Fixed the Rails/ActionFilter cop
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-04-20 15:39:37 +02:00
Dmitriy Zaporozhets f0cbbd70bb Use same constant for amount of items per page 2015-03-12 15:37:00 -07:00
Dmitriy Zaporozhets 83f7e98d9a Add project filter by visibility and tag to explore page 2015-03-10 15:59:14 -07:00
Dmitriy Zaporozhets 86d5e20664 Respect star ordering on explore page 2015-02-18 16:40:22 -08:00
Ciro Santilli b66a152735 Factor abilities methods
in app controller, user model and services.
2014-10-19 11:12:39 +02:00
Dmitriy Zaporozhets 974b5a7b2f
Most starred projects page for Explore area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-07-25 22:05:23 +03:00
Dmitriy Zaporozhets 367445fdcd
Refactor explore area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-07-23 12:03:49 +03:00