summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-10-24 12:00:08 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2016-10-24 12:00:08 +0200
commit1a7ba2a5e8603222b51a9e9cf0ffcde68cf593d2 (patch)
tree590387da763f7e48b13f8b03762460d9ad06fbd9 /app
parent352ab2fac6226c7f534eda1b37d18ec1c0f84ac4 (diff)
parent8a3710f452dc2192c936b1b418d2e1a90f5ae65f (diff)
downloadgitlab-ce-1a7ba2a5e8603222b51a9e9cf0ffcde68cf593d2.tar.gz
Merge remote-tracking branch 'origin/sh-flush-cache-after-import'
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb27
1 files changed, 15 insertions, 12 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 1b7f20a2134..4ae9c20726f 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -419,6 +419,17 @@ class Repository
@exists = nil
end
+ # expire cache that doesn't depend on repository data (when expiring)
+ def expire_content_cache
+ expire_tags_cache
+ expire_tag_count_cache
+ expire_branches_cache
+ expire_branch_count_cache
+ expire_root_ref_cache
+ expire_emptiness_caches
+ expire_exists_cache
+ end
+
# Runs code after a repository has been created.
def after_create
expire_exists_cache
@@ -434,14 +445,7 @@ class Repository
expire_cache if exists?
- # expire cache that don't depend on repository data (when expiring)
- expire_tags_cache
- expire_tag_count_cache
- expire_branches_cache
- expire_branch_count_cache
- expire_root_ref_cache
- expire_emptiness_caches
- expire_exists_cache
+ expire_content_cache
repository_event(:remove_repository)
end
@@ -473,14 +477,13 @@ class Repository
end
def before_import
- expire_emptiness_caches
- expire_exists_cache
+ expire_content_cache
end
# Runs code after a repository has been forked/imported.
def after_import
- expire_emptiness_caches
- expire_exists_cache
+ expire_content_cache
+ build_cache
end
# Runs code after a new commit has been pushed.