diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-09-23 09:11:45 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-09-23 09:11:45 +0000 |
commit | 63c74eda71528edb0872f22656fe4c0567cb31d3 (patch) | |
tree | 043920023bb71abf311eca44f62b1443bf63a859 /lib | |
parent | 894d8c16866b58e74791c933968a5a08c7aeb901 (diff) | |
parent | a878cf13734bfaa0f1f0db187a4a4aa436057be5 (diff) | |
download | gitlab-shell-63c74eda71528edb0872f22656fe4c0567cb31d3.tar.gz |
Merge branch 'ionice-mv' into 'master'
Set a low IO priority for storage moves to lower performance impact
See merge request !92
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab_projects.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index a40cc4f..3d92cf2 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -316,7 +316,17 @@ class GitlabProjects if wait_for_pushes $logger.info "Syncing project #{@project_name} from <#{full_path}> to <#{new_full_path}>." - system(*%W(rsync -a --delete #{source_path} #{new_full_path})) + + # Set a low IO priority with ionice to not choke the server on moves + rsync_path = 'ionice -c2 -n7 rsync' + result = system(*%W(#{rsync_path} -a --delete --rsync-path="#{rsync_path}" #{source_path} #{new_full_path})) + + unless result + # If the command fails with `ionice` (maybe because we're on a OS X + # development machine), try again without `ionice`. + rsync_path = 'rsync' + system(*%W(#{rsync_path} -a --delete --rsync-path="#{rsync_path}" #{source_path} #{new_full_path})) + end else $logger.error "mv-storage failed: source path <#{full_path}> is waiting for pushes to finish." false |