Commit 5818a122 authored by Jeremy Morrell's avatar Jeremy Morrell Committed by Jeremy Morrell

tweaking

parent 306d2dee
......@@ -4,7 +4,7 @@ calculate_concurrency() {
WEB_CONCURRENCY=${WEB_CONCURRENCY-$((MEMORY_AVAILABLE/WEB_MEMORY))}
if (( WEB_CONCURRENCY < 1 )); then
WEB_CONCURRENCY=1
elif (( WEB_CONCURRENCY > 100 )); then
elif (( WEB_CONCURRENCY > 200 )); then
# Ex: This will happen on Dokku on DO
WEB_CONCURRENCY=1
fi
......@@ -27,25 +27,24 @@ detect_memory() {
}
warn_bad_web_concurrency() {
local memory=${MEMORY_AVAILABLE-$(detect_memory 512)}
# No webserver will have 10000GB of RAM
if [ $memory -gt "10000000" ]; then
local concurrency=$((MEMORY_AVAILABLE/WEB_MEMORY))
if [ "$concurrency" -gt "200" ]; then
echo "Could not determine a reasonable value for WEB_CONCCURENCY.
This is likely due to running the Heroku NodeJS buildpack on a non-Heroku
platform.
WEB_CONCURRENCY has been set to 1. Please review whether this value is
appropriate for your application."
echo ""
fi
}
warn_bad_web_concurrency
export MEMORY_AVAILABLE=${MEMORY_AVAILABLE-$(detect_memory 512)}
export WEB_MEMORY=${WEB_MEMORY-512}
export WEB_CONCURRENCY=$(calculate_concurrency)
warn_bad_web_concurrency
if [[ "${LOG_CONCURRENCY+isset}" && "$LOG_CONCURRENCY" == "true" ]]; then
log_concurrency
fi
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