diff --git a/bin/celery_flower.sh b/bin/celery_flower.sh index f402ae9a..0c17324e 100755 --- a/bin/celery_flower.sh +++ b/bin/celery_flower.sh @@ -5,4 +5,13 @@ set -e # Set defaults for OTEL export OTEL_SERVICE_NAME="${OTEL_SERVICE_NAME:-objects-flower}" -exec celery --app objects --workdir src flower +# 100x less than the defaults +export FLOWER_MAX_TASKS="${FLOWER_MAX_TASKS:-1000}" +export FLOWER_MAX_WORKERS="${FLOWER_MAX_WORKERS:-50}" + +# TODO: rename CELERY_RESULT_BACKEND to CELERY_BROKER_URL +BROKER_URL="${CELERY_BROKER_URL:-${CELERY_RESULT_BACKEND:-redis://localhost:6379/0}}" + +exec celery \ + --broker "${BROKER_URL}" \ + flower \ No newline at end of file diff --git a/bin/docker_start.sh b/bin/docker_start.sh index 08843289..ab3acecd 100755 --- a/bin/docker_start.sh +++ b/bin/docker_start.sh @@ -50,6 +50,9 @@ if [ -n "${OBJECTS_SUPERUSER_USERNAME}" ]; then unset OBJECTS_SUPERUSER_USERNAME OBJECTS_SUPERUSER_EMAIL OBJECTS_SUPERUSER_PASSWORD fi +# Periodically recycle workers - recover memory in the event of memory leaks +export UWSGI_MAX_REQUESTS=${UWSGI_MAX_REQUESTS:-1000} + # Start server >&2 echo "Starting server" uwsgi \