Commit 46347f14 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'improve-background-jobs-script' into 'master'

Improve bin/background_jobs script

See merge request gitlab-org/gitlab!72016
parents ebc27391 85cb6e69
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
cd $(dirname $0)/.. cd $(dirname $0)/..
app_root=$(pwd) app_root=$(pwd)
sidekiq_workers=${SIDEKIQ_WORKERS:-1} sidekiq_workers=${SIDEKIQ_WORKERS:-1}
sidekiq_queues=${SIDEKIQ_QUEUES:-*} # Queues to listen to; default to `*` (all)
sidekiq_pidfile="$app_root/tmp/pids/sidekiq-cluster.pid" sidekiq_pidfile="$app_root/tmp/pids/sidekiq-cluster.pid"
sidekiq_logfile="$app_root/log/sidekiq.log" sidekiq_logfile="$app_root/log/sidekiq.log"
gitlab_user=$(ls -l config.ru | awk '{print $3}') gitlab_user=$(ls -l config.ru | awk '{print $3}')
...@@ -37,8 +38,7 @@ restart() ...@@ -37,8 +38,7 @@ restart()
stop stop
fi fi
warn "Sidekiq output will be written to $sidekiq_logfile" start_sidekiq "$@"
start_sidekiq "$@" >> $sidekiq_logfile 2>&1
} }
start_sidekiq() start_sidekiq()
...@@ -50,13 +50,13 @@ start_sidekiq() ...@@ -50,13 +50,13 @@ start_sidekiq()
cmd="${cmd} ${chpst} -P" cmd="${cmd} ${chpst} -P"
fi fi
# sidekiq-cluster expects '*' '*' arguments (one wildcard for each process). # sidekiq-cluster expects an argument per process.
for (( i=1; i<=$sidekiq_workers; i++ )) for (( i=1; i<=$sidekiq_workers; i++ ))
do do
processes_args+=("*") processes_args+=("${sidekiq_queues}")
done done
${cmd} bin/sidekiq-cluster "${processes_args[@]}" -P $sidekiq_pidfile -e $RAILS_ENV "$@" ${cmd} bin/sidekiq-cluster "${processes_args[@]}" -P $sidekiq_pidfile -e $RAILS_ENV "$@" 2>&1 | tee -a $sidekiq_logfile
} }
action="$1" action="$1"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment