Commit 903f9491ba097909f7d2e66873ff25d1505df07e
1 parent
ff8136cd
Exists in
master
and in
4 other branches
MR: change path to lock file
Showing
1 changed file
with
2 additions
and
4 deletions
Show diff stats
lib/gitlab_merge.rb
| @@ -26,11 +26,9 @@ class GitlabMerge | @@ -26,11 +26,9 @@ class GitlabMerge | ||
| 26 | 26 | ||
| 27 | def process | 27 | def process |
| 28 | Grit::Git.with_timeout(30.seconds) do | 28 | Grit::Git.with_timeout(30.seconds) do |
| 29 | - # Make sure tmp/merge_repo exists | ||
| 30 | - lock_path = File.join(Rails.root, "tmp", "merge_repo") | ||
| 31 | - FileUtils.mkdir_p(lock_path) unless File.exists?(File.join(Rails.root, "tmp", "merge_repo")) | 29 | + lock_file = File.join(Rails.root, "tmp", "merge_repo_#{project.path}.lock") |
| 32 | 30 | ||
| 33 | - File.open(File.join(lock_path, "#{project.path}.lock"), "w+") do |f| | 31 | + File.open(lock_file, "w+") do |f| |
| 34 | f.flock(File::LOCK_EX) | 32 | f.flock(File::LOCK_EX) |
| 35 | 33 | ||
| 36 | unless project.satellite.exists? | 34 | unless project.satellite.exists? |