Merge branch 'mailroom-restart-loop' into 'master'

Add sleep during mailroom restart loop

"Fixes" https://github.com/gitlabhq/gitlabhq/issues/9891

See merge request !611
This commit is contained in:
Marin Jankovski 2016-01-21 09:49:43 +00:00
commit 378f2355c5
2 changed files with 16 additions and 1 deletions

View File

@ -31,7 +31,7 @@ directory mailroom_log_dir do
end
runit_service 'mailroom' do
template_name 'mailroom'
finish_script true
options({
:user => user,
:log_directory => mailroom_log_dir,

View File

@ -0,0 +1,15 @@
#!/bin/sh
# Fixes https://github.com/gitlabhq/gitlabhq/issues/9891 :
# mailroom respawn loop pinning the CPU.
if [ x$2 = x15 ] ; then
# mailroom received SIGTERM (15) so this is probably a
# user-initiated restart. Skip the waiting.
exit 0
fi
# If the user runs 'gitlab-ctl restart mailroom' during this sleep
# they may get a timeout, unfortunately.
wait=30
echo "Runit: waiting ${wait} seconds before restarting mail_room"
sleep ${wait}