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 @@
cd $(dirname $0)/..
app_root=$(pwd)
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_logfile="$app_root/log/sidekiq.log"
gitlab_user=$(ls -l config.ru | awk '{print $3}')
......@@ -37,8 +38,7 @@ restart()
stop
fi
warn "Sidekiq output will be written to $sidekiq_logfile"
start_sidekiq "$@" >> $sidekiq_logfile 2>&1
start_sidekiq "$@"
}
start_sidekiq()
......@@ -50,13 +50,13 @@ start_sidekiq()
cmd="${cmd} ${chpst} -P"
fi
# sidekiq-cluster expects '*' '*' arguments (one wildcard for each process).
# sidekiq-cluster expects an argument per process.
for (( i=1; i<=$sidekiq_workers; i++ ))
do
processes_args+=("*")
processes_args+=("${sidekiq_queues}")
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"
......
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