supabase-postgres.git / summary / log / commit / refs

commit    b62c2e5e1faab1081f93848113bf67f6b273e8ab
Author:   Paul Cioanca <paul.cioanca@supabase.io>
Commit:   GitHub <noreply@github.com>
Date:     Fri Jan 26 15:07:38 2024 +0000

    chore: tweak autoshutdown script (#859)


docker/all-in-one/shutdown.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker/all-in-one/shutdown.sh b/docker/all-in-one/shutdown.sh index cc0a2628..9f5beb25 100755 --- a/docker/all-in-one/shutdown.sh +++ b/docker/all-in-one/shutdown.sh @@ -65,6 +65,11 @@ SQL fi } +# Wait for Postgres to be up +until pg_isready -h localhost > /dev/null 2>&1; + do sleep 3 +done + # Enable logging of disconnections so the script can check when the last disconnection happened run_sql -c "ALTER SYSTEM SET log_disconnections = 'on';" run_sql -c "SELECT pg_reload_conf();" @@ -83,6 +88,9 @@ while true; do MAX_IDLE_TIME_MINUTES="$DEFAULT_MAX_IDLE_TIME_MINUTES" fi - check_activity + if [ "$MAX_IDLE_TIME_MINUTES" -gt 0 ] && [ "$MAX_IDLE_TIME_MINUTES" -lt 50000000 ]; then + check_activity + fi + sleep 30 done [parent: 4f5d255282e1]