Skip to content

Commit

Permalink
chore: update redis and postgresql start scripts retrytimes (apecloud…
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Rookie authored Jul 12, 2023
1 parent 7b41213 commit 9becbe2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions deploy/postgresql/templates/scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ data:
# Waiting for primary pod information from the DownwardAPI annotation to be available, with a maximum of 5 attempts
attempt=1
max_attempts=5
max_attempts=60
while [ $attempt -le $max_attempts ] && [ -z "$(cat /kb-podinfo/primary-pod)" ]; do
sleep 5
attempt=$((attempt + 1))
Expand All @@ -92,14 +92,14 @@ data:
echo "DownwardAPI get primary=$primary" >> /home/postgres/pgdata/.kb_set_up.log
echo "KB_POD_NAME=$KB_POD_NAME" >> /home/postgres/pgdata/.kb_set_up.log
if [ -z "$primary" ]; then
echo "Primary pod information not available. Exiting..."
echo "Error: Primary pod information not available. Exiting..."
exit 1
fi
# usage: retry <command>
# e.g. retry pg_isready -U postgres -h $primary_fqdn -p 5432
function retry {
local max_attempts=10
local max_attempts=20
local attempt=1
until "$@" || [ $attempt -eq $max_attempts ]; do
echo "Command '$*' failed. Attempt $attempt of $max_attempts. Retrying in 5 seconds..."
Expand Down
6 changes: 3 additions & 3 deletions deploy/redis/templates/scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
set -e
# Waiting for primary pod information from the DownwardAPI annotation to be available, with a maximum of 5 attempts
attempt=1
max_attempts=5
max_attempts=60
while [ $attempt -le $max_attempts ] && [ -z "$(cat /kb-podinfo/primary-pod)" ]; do
sleep 5
attempt=$((attempt + 1))
Expand All @@ -19,13 +19,13 @@ data:
echo "DownwardAPI get primary=$primary" >> /etc/redis/.kb_set_up.log
echo "KB_POD_NAME=$KB_POD_NAME" >> /etc/redis/.kb_set_up.log
if [ -z "$primary" ]; then
echo "Primary pod information not available. Exiting..."
echo "Error: Primary pod information not available. Exiting..."
exit 1
fi
# usage: retry <command>
retry() {
local max_attempts=10
local max_attempts=20
local attempt=1
until "$@" || [ $attempt -eq $max_attempts ]; do
echo "Command '$*' failed. Attempt $attempt of $max_attempts. Retrying in 5 seconds..."
Expand Down

0 comments on commit 9becbe2

Please sign in to comment.