Do gitolite calls async. Remove satellite with project remove

This commit is contained in:
Dmitriy Zaporozhets 2013-01-28 17:22:45 +02:00
parent b4f16faafd
commit 1c5876eb7b
12 changed files with 90 additions and 52 deletions

View file

@ -299,6 +299,9 @@ class Project < ActiveRecord::Base
def trigger_post_receive(oldrev, newrev, ref, user)
data = post_receive_data(oldrev, newrev, ref, user)
# Create satellite
self.satellite.create unless self.satellite.exists?
# Create push event
self.observe_push(data)
@ -313,9 +316,6 @@ class Project < ActiveRecord::Base
self.execute_services(data.dup)
end
# Create satellite
self.satellite.create unless self.satellite.exists?
# Discover the default branch, but only if it hasn't already been set to
# something else
if repository && default_branch.nil?
@ -460,11 +460,17 @@ class Project < ActiveRecord::Base
end
def update_repository
gitolite.update_repository(self)
GitoliteWorker.perform_async(
:update_repository,
self.id
)
end
def destroy_repository
gitolite.remove_repository(self)
GitoliteWorker.perform_async(
:remove_repository,
self.path_with_namespace
)
end
def repo_exists?

View file

@ -129,7 +129,7 @@ class UsersProject < ActiveRecord::Base
end
def update_repository
gitolite.update_repository(project)
project.update_repository
end
def project_access_human