summaryrefslogtreecommitdiff
path: root/bin/prioritize-build-list
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-10-23 13:13:53 +0200
committerErich Eckner <git@eckner.net>2018-10-23 13:13:53 +0200
commit0270dddb465d967528873b88eb15116216b10092 (patch)
treed50389f8f83fb5e8475ac442a86e14cc3df7ac4a /bin/prioritize-build-list
parentd6eb55cf248c13d4acb9563d2e770e7b3c8c7c7a (diff)
downloadbuilder-0270dddb465d967528873b88eb15116216b10092.tar.xz
bin/prioritize-build-list: cleanup
Diffstat (limited to 'bin/prioritize-build-list')
-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
} | \