diff --git a/scripts/run_celery_send_sms.sh b/scripts/run_celery_send_sms.sh index 1b8ea7de50..e6c32a5d75 100755 --- a/scripts/run_celery_send_sms.sh +++ b/scripts/run_celery_send_sms.sh @@ -2,8 +2,27 @@ # runs celery with only the send-sms-* queues +init() +{ + # Wait for cwagent to become available. + while : + do + if nc -vz $STATSD_HOST 25888; then + echo "CWAgent is Ready." + break; + else + echo "Waiting for CWAgent to become ready." + sleep 1 + fi + done +} + set -e +if [[ -z "${STATSD_HOST}" ]]; then + init +fi + echo "Start celery, concurrency: ${CELERY_CONCURRENCY-4}" # TODO: we shouldn't be using the send-sms-tasks queue anymore - once we verify this we can remove it