Skip to content

Commit

Permalink
feat: or-1349 always restore services
Browse files Browse the repository at this point in the history
  • Loading branch information
koenmetsu committed Dec 22, 2023
1 parent 1323376 commit b866595
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions .aws/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ wait_for_desired_count() {
# exit 1
# fi

cleanup() {
# Restore original desired counts
for service in $SERVICES; do
original_count=${original_counts["$service"]}
update_service_count "$CLUSTER_ARN" "$service" $original_count
echo "Restored desired count for service $serviceArn: $original_count"
done

for service in $SERVICES; do
original_count=${original_counts["$service"]}
wait_for_desired_count "$CLUSTER_ARN" "$service" $original_count
echo "Desired count restored for service $serviceArn: $original_count"
done

echo ""
echo "Done."
}

# Set trap to call cleanup function on exit
trap cleanup EXIT

# Disable CLI paging for this script
export AWS_PAGER=""

Expand Down Expand Up @@ -99,16 +120,3 @@ echo "Deletion process completed."

# Reset database

# Restore original desired counts
for service in $SERVICES; do
original_count=${original_counts["$service"]}
update_service_count "$CLUSTER_ARN" "$service" $original_count
echo "Restored desired count for service $serviceArn: $original_count"
done

for service in $SERVICES; do
update_service_count "$CLUSTER_ARN" "$service" 1
done

echo ""
echo "Done."

0 comments on commit b866595

Please sign in to comment.