summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/prioritize-build-list13
1 files changed, 6 insertions, 7 deletions
diff --git a/bin/prioritize-build-list b/bin/prioritize-build-list
index 5e815bc..2492d54 100755
--- a/bin/prioritize-build-list
+++ b/bin/prioritize-build-list
@@ -102,7 +102,7 @@ verbose_flock ${wait_for_lock} 8
printf 'UPDATE `build_assignments`'
printf ' JOIN ('
printf 'SELECT'
- printf ' `s_ba`.`id`,'
+ printf ' `s_ba`.`id` AS `build_assignment`,'
printf 'MAX(`g_ba`.`priority`) AS `priority`'
printf ' FROM `build_assignments` AS `g_ba`'
mysql_join_build_assignments_binary_packages 'g_ba' 'g_bp'
@@ -119,12 +119,11 @@ verbose_flock ${wait_for_lock} 8
"${repository_ids__any_build_list}"
mysql_join_binary_packages_build_assignments 's_bp' 's_ba'
printf ' GROUP BY `s_ba`.`id`'
- printf ') AS `s_ba`'
- printf ' ON `s_ba`.`id`=`build_assignments`.`id`'
- printf ' SET `build_assignments`.`priority`=GREATEST('
- printf '`s_ba`.`priority`,'
- printf '`build_assignments`.`priority`'
- printf ');\n'
+ printf ') AS `sub_q`'
+ printf ' ON `sub_q`.`build_assignment`=`build_assignments`.`id`'
+ printf ' SET `build_assignments`.`priority`=`sub_q`.`priority`'
+ printf ' WHERE `build_assignments`.`priority`<`sub_q`.`priority`'
+ printf ';\n'
printf 'SELECT row_count();\n'
fi
} | \