summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-04-25 14:14:39 +0200
committerErich Eckner <git@eckner.net>2018-04-25 14:14:39 +0200
commit42235c298c9666b06cf1d6ced7346882ce0f1b33 (patch)
tree7a8caf35dd58b9ae41225496484aadb7f1d9d641 /lib
parentbea2e56b0b86d478c0d5247b2c8ed8a939eac349 (diff)
downloadbuilder-42235c298c9666b06cf1d6ced7346882ce0f1b33.tar.xz
lib/mysql-functions: mysql_cleanup: a build_assignment might be handed out a couple of times, with one set of built packages not on the build-list anymore - do not remove build_assignments in that case
Diffstat (limited to 'lib')
-rwxr-xr-xlib/mysql-functions13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 8101e0c..a15a8bb 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -882,16 +882,19 @@ mysql_cleanup() {
printf ');\n'
# remove jobs from build slaves that are not on the build-list
if [ "${operator}" = 'DELETE' ]; then
- printf 'UPDATE `build_slaves`'
+ printf 'UPDATE `repositories`'
else
- printf 'SELECT COUNT(DISTINCT `build_slaves`.`id`) FROM `build_slaves`'
+ printf 'SELECT COUNT(DISTINCT `build_slaves`.`id`) FROM `repositories`'
fi
- mysql_join_build_slaves_binary_packages
- mysql_join_binary_packages_repositories
+ mysql_join_repositories_binary_packages
+ printf ' AND `repositories`.`name`="build-list"'
+ printf ' RIGHT'
+ mysql_join_binary_packages_build_slaves
if [ "${operator}" = 'DELETE' ]; then
printf ' SET `build_slaves`.`currently_building`=NULL'
fi
- printf ' WHERE `repositories`.`name`!="build-list";\n'
+ printf ' WHERE `build_slaves`.`currently_building` IS NOT NULL'
+ printf ' AND `repositories`.`id` IS NULL;\n'
# remove build orders from build slaves which have not connected within 1h
if [ "${operator}" = 'DELETE' ]; then
printf 'UPDATE `build_slaves`'