added redis dependency and start_pre loop to check that redis is ready

This commit is contained in:
2026-05-01 12:44:30 -05:00
parent 4debdbc6c5
commit e194508cfd

View File

@@ -3,11 +3,24 @@
. /etc/conf.d/mastodon . /etc/conf.d/mastodon
name="Mastodon background workers Service" name="Mastodon background workers Service"
pidfile="${INSTALLROOT}/worker.pid" pidfile="${INSTALLROOT}/worker.pid"
depend() { depend() {
use net use net
need redis-server
}
pre_start() {
if [ "${RC_CMD}" != "restart" ] ; then
for run in {1..10}; do
status="$(redis-cli ping)"
if [[ "$status" == "PONG" ]]; then
exit 0
fi
sleep 1
done
return 1
fi
} }
start() { start() {
@@ -19,7 +32,7 @@ start() {
--pidfile="${pidfile}" \ --pidfile="${pidfile}" \
-3 logger \ -3 logger \
-4 logger \ -4 logger \
-b -m \ -C -b -m \
--exec /usr/bin/env -- RAILS_ENV=production DB_POOL=${DB_POOL} \ --exec /usr/bin/env -- RAILS_ENV=production DB_POOL=${DB_POOL} \
bundle exec sidekiq -c ${SIDEKIQ_WORKERS} -q default,8 -q scheduler,1 -q mailers,1 -q push,6 -q ingress,4 -q pull,1 -q fasp bundle exec sidekiq -c ${SIDEKIQ_WORKERS} -q default,8 -q scheduler,1 -q mailers,1 -q push,6 -q ingress,4 -q pull,1 -q fasp
eend $? eend $?