diff options
author | Valery Sizov <vsv2711@gmail.com> | 2012-04-27 02:09:23 +0400 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2012-04-27 02:09:23 +0400 |
commit | 903f9491ba097909f7d2e66873ff25d1505df07e (patch) | |
tree | c62464ecd0f47dacc8f45a754546f1377642d386 | |
parent | ff8136cda21612e2a5db2bc7c1f7917fc3822091 (diff) |
MR: change path to lock file
-rw-r--r-- | lib/gitlab_merge.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/gitlab_merge.rb b/lib/gitlab_merge.rb index 1c0923dedd5..3bc9ac378c5 100644 --- a/lib/gitlab_merge.rb +++ b/lib/gitlab_merge.rb @@ -26,11 +26,9 @@ class GitlabMerge def process Grit::Git.with_timeout(30.seconds) do - # Make sure tmp/merge_repo exists - lock_path = File.join(Rails.root, "tmp", "merge_repo") - FileUtils.mkdir_p(lock_path) unless File.exists?(File.join(Rails.root, "tmp", "merge_repo")) + lock_file = File.join(Rails.root, "tmp", "merge_repo_#{project.path}.lock") - File.open(File.join(lock_path, "#{project.path}.lock"), "w+") do |f| + File.open(lock_file, "w+") do |f| f.flock(File::LOCK_EX) unless project.satellite.exists? |