gitlab-org--gitlab-foss/app/workers
Yorick Peterse ffb9b3ef18
Refactor cache refreshing/expiring
This refactors repository caching so it's possible to selectively
refresh certain caches, instead of just expiring and refreshing
everything.

To allow this the various methods that were cached (e.g. "tag_count" and
"readme") use a similar pattern that makes expiring and refreshing
their data much easier.

In this new setup caches are refreshed as follows:

1. After a commit (but before running ProjectCacheWorker) we expire some
   basic caches such as the commit count and repository size.

2. ProjectCacheWorker will recalculate the commit count, repository
   size, then refresh a specific set of caches based on the list of
   files changed in a push payload.

This requires a bunch of changes to the various methods that may be
cached. For one, data should not be cached if a branch used or the
entire repository does not exist. To prevent all these methods from
handling this manually this is taken care of in
Repository#cache_method_output. Some methods still manually check for
the existence of a repository but this result is also cached.

With selective flushing implemented ProjectCacheWorker no longer uses an
exclusive lease for all of its work. Instead this worker only uses a
lease to limit the number of times the repository size is updated as
this is a fairly expensive operation.
2016-11-21 15:05:13 +01:00
..
concerns
repository_check
admin_email_worker.rb
authorized_projects_worker.rb Precalculate user's authorized projects in database 2016-11-18 20:25:45 +02:00
build_coverage_worker.rb
build_email_worker.rb
build_finished_worker.rb
build_hooks_worker.rb
build_success_worker.rb Fix tests and add has_environment? 2016-11-17 12:08:28 +01:00
clear_database_cache_worker.rb
delete_merged_branches_worker.rb
delete_user_worker.rb
email_receiver_worker.rb
emails_on_push_worker.rb
expire_build_artifacts_worker.rb
expire_build_instance_artifacts_worker.rb
git_garbage_collect_worker.rb
gitlab_shell_worker.rb
group_destroy_worker.rb
import_export_project_cleanup_worker.rb
irker_worker.rb
merge_worker.rb
new_note_worker.rb
pipeline_hooks_worker.rb
pipeline_metrics_worker.rb
pipeline_notification_worker.rb
pipeline_process_worker.rb
pipeline_success_worker.rb
pipeline_update_worker.rb
post_receive.rb
process_commit_worker.rb
project_cache_worker.rb Refactor cache refreshing/expiring 2016-11-21 15:05:13 +01:00
project_destroy_worker.rb
project_export_worker.rb
project_service_worker.rb
project_web_hook_worker.rb
prune_old_events_worker.rb
remove_expired_group_links_worker.rb
remove_expired_members_worker.rb
remove_unreferenced_lfs_objects_worker.rb
repository_archive_cache_worker.rb
repository_fork_worker.rb
repository_import_worker.rb
requests_profiles_worker.rb
stuck_ci_builds_worker.rb
system_hook_worker.rb
trending_projects_worker.rb
update_merge_requests_worker.rb