Move locking from Satellite::Action to Satellite and add checks
This commit is contained in:
parent
0e9d4f30f4
commit
0ebcc60a33
2 changed files with 27 additions and 22 deletions
|
@ -18,18 +18,8 @@ module Gitlab
|
|||
# * Yields the prepared satellite repo
|
||||
def in_locked_and_timed_satellite
|
||||
Grit::Git.with_timeout(options[:git_timeout]) do
|
||||
File.open(lock_file, "w+") do |f|
|
||||
f.flock(File::LOCK_EX)
|
||||
|
||||
unless project.satellite.exists?
|
||||
raise "Satellite doesn't exist"
|
||||
end
|
||||
|
||||
Dir.chdir(project.satellite.path) do
|
||||
repo = Grit::Repo.new('.')
|
||||
|
||||
return yield repo
|
||||
end
|
||||
project.satellite.lock do
|
||||
return yield project.satellite.repo
|
||||
end
|
||||
end
|
||||
rescue Errno::ENOMEM => ex
|
||||
|
@ -40,10 +30,6 @@ module Gitlab
|
|||
return false
|
||||
end
|
||||
|
||||
def lock_file
|
||||
Rails.root.join("tmp", "#{project.path}.lock")
|
||||
end
|
||||
|
||||
# * Clears the satellite
|
||||
# * Updates the satellite from Gitolite
|
||||
# * Sets up Git variables for the user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue