From c9f3c1ae34a9ae0c2f404ab75714bd9b1903df39 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Tue, 5 Apr 2022 12:12:06 +0200 Subject: [PATCH] [fix] No infinite loop --- scripts/upgrade | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 75f6618..250852c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -317,8 +317,16 @@ then # https://docs.gitlab.com/ee/update/#checking-for-background-migrations-before-upgrading if dpkg --compare-versions "$current_version" "ge" "12.9"; then + + counter=0 while ! gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining' do + counter=$((counter + 1)) + if [ $counter -gt 1200 ] + then + ynh_print_warn --message="Timeout: a background migration runs for at least 20min !" + break + fi ynh_print_info --message="Wait for the migration in the background to finish" sleep 1 done