summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-03-18 15:31:19 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-03-19 21:54:08 +0100
commit68a4c98f5074bd34f0178f2f967153c8d5c71237 (patch)
tree34ecc0cb78dfd4c80a181aece464689ae75b7dbb /app/workers
parent41b8d22631053e66043d05695d65f4961b91efd8 (diff)
downloadgitlab-ce-68a4c98f5074bd34f0178f2f967153c8d5c71237.tar.gz
Cache output of Repository#exists?
This caches the output of Repository#exists? in Redis while making sure it's flushed properly when creating new repositories, deleting them, etc. For the ProjectWiki tests to work I had to make ProjectWiki#create_repo! public as testing private methods in RSpec is a bit of a pain.
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/repository_fork_worker.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/workers/repository_fork_worker.rb b/app/workers/repository_fork_worker.rb
index 21d311579e3..f9e32337983 100644
--- a/app/workers/repository_fork_worker.rb
+++ b/app/workers/repository_fork_worker.rb
@@ -20,14 +20,15 @@ class RepositoryForkWorker
return
end
+ project.repository.after_import
+
unless project.valid_repo?
- logger.error("Project #{id} had an invalid repository after fork")
+ logger.error("Project #{project_id} had an invalid repository after fork")
project.update(import_error: "The forked repository is invalid.")
project.import_fail
return
end
- project.repository.after_import
project.import_finish
end
end