From 903f9491ba097909f7d2e66873ff25d1505df07e Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Fri, 27 Apr 2012 01:09:23 +0300 Subject: [PATCH] MR: change path to lock file --- lib/gitlab_merge.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/gitlab_merge.rb b/lib/gitlab_merge.rb index 1c0923de..3bc9ac37 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?