gitlab-org--gitlab-foss/config/initializers
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
..
1_settings.rb Precalculate trending projects 2016-10-10 12:27:08 +02:00
2_app.rb
4_ci_app.rb
5_backend.rb
6_validations.rb
7_redis.rb Initialize Redis pool in single-threaded context 2016-09-30 12:27:43 +02:00
active_record_query_trace.rb
ar5_batching.rb Add markdown cache columns to the database, but don't use them yet 2016-10-07 02:54:25 +01:00
ar_monkey_patch.rb
ar_speed_up_migration_checking.rb Memoize ActiveRecord::Migrator.migrations in tests 2016-10-06 19:14:57 +01:00
attr_encrypted_no_db_connection.rb Use Module#prepend instead of alias_method_chain 2016-09-30 07:08:25 -03:00
backtrace_silencers.rb
bullet.rb
carrierwave.rb
chronic_duration.rb
connection_fix.rb
cookies_serializer.rb
date_time_formats.rb
default_url_options.rb
devise.rb
devise_password_length.rb.example
disable_email_interceptor.rb
doorkeeper.rb
gitlab_shell_secret_token.rb Load Github::Shell's secret token from file on initialization instead of every request. 2016-10-06 11:22:37 -04:00
gitlab_workhorse_secret.rb
go_get.rb
gollum.rb
hamlit.rb
health_check.rb
inflections.rb
kaminari_config.rb
metrics.rb
mime_types.rb
mysql_ignore_postgresql_options.rb
omniauth.rb
postgresql_limit_fix.rb Use Module#prepend instead of alias_method_chain 2016-09-30 07:08:25 -03:00
postgresql_opclasses_support.rb
premailer.rb
public_key.rb
rack_attack.rb.example
rack_attack_git_basic_auth.rb
rack_lineprof.rb
relative_naming_ci_namespace.rb
relative_url.rb.sample
request_profiler.rb
secret_token.rb
sentry.rb Don't send Private-Token headers to Sentry 2016-10-04 16:57:01 +02:00
session_store.rb
sherlock.rb
sidekiq.rb
smtp_settings.rb.sample
static_files.rb
time_zone.rb
trusted_proxies.rb
wrap_parameters.rb