Skip to content

Commit

Permalink
do not go lower than 100 connections
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <szaimen@e.mail.de>
  • Loading branch information
szaimen committed Oct 26, 2023
1 parent 00ec781 commit 416f50b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Containers/postgresql/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ if [ -f "/var/lib/postgresql/data/postgresql.conf" ]; then
MEMORY=$(awk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
MAX_CONNECTIONS=$((MEMORY/50+3))
if [ -n "$MAX_CONNECTIONS" ]; then
# 100 is the default, we do not want to go lower than this
if [ "$MAX_CONNECTIONS" -lt 100 ]; then
MAX_CONNECTIONS=100
fi
sed -i "s|^max_connections =.*|max_connections = $MAX_CONNECTIONS|" "/var/lib/postgresql/data/postgresql.conf"
fi

Expand Down

0 comments on commit 416f50b

Please sign in to comment.