Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/mysql-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-27 11:23:40 +0200
committerErich Eckner <git@eckner.net>2018-03-27 11:23:40 +0200
commit0070184c30396f71bd30e18af0733fd8b6cd33cf (patch)
tree7baa785b783ac6688beb986e32d47b15df9ea4be /lib/mysql-functions
parentf4199956fa46eb08e0bbef978529c30fedba8520 (diff)
lib/mysql-functions: mysql_cleanup now also removes build_slaves.logged_lines
Diffstat (limited to 'lib/mysql-functions')
-rwxr-xr-xlib/mysql-functions23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 8e8217b..aa15192 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -862,19 +862,36 @@ mysql_cleanup() {
printf 'SELECT * FROM `build_assignments` '
printf 'WHERE `build_assignments`.`package_source`=`package_sources`.`id`'
printf ');\n'
- printf 'UPDATE `build_slaves`'
+ # remove jobs from build slaves that are not on the build-list
+ if [ "${operator}" = 'DELETE' ]; then
+ printf 'UPDATE `build_slaves`'
+ else
+ printf 'SELECT COUNT(DISTINCT `build_slaves`.`id`) FROM `build_slaves`'
+ fi
mysql_join_build_slaves_binary_packages
mysql_join_binary_packages_repositories
- printf ' SET `currently_building`=NULL'
+ if [ "${operator}" = 'DELETE' ]; then
+ printf ' SET `build_slaves`.`currently_building`=NULL'
+ fi
printf ' WHERE `repositories`.`name`!="build-list";\n'
# remove build orders from build slaves which have not connected within 1h
if [ "${operator}" = 'DELETE' ]; then
- printf 'UPDATE `build_slaves` SET `build_slaves`.`currently_building`=NULL'
+ printf 'UPDATE `build_slaves`'
+ printf ' SET `build_slaves`.`currently_building`=NULL'
else
printf 'SELECT COUNT(*) FROM `build_slaves`'
fi
printf ' WHERE `build_slaves`.`currently_building` IS NOT NULL'
printf ' AND TIMEDIFF(NOW(),`build_slaves`.`last_connection`) > "1:00:00";\n'
+ # remove `logged_lines` from buildslaves without an assignment
+ if [ "${operator}" = 'DELETE' ]; then
+ printf 'UPDATE `build_slaves`'
+ printf ' SET `build_slaves`.`logged_lines`=NULL'
+ else
+ printf 'SELECT COUNT(*) FROM `build_slaves`'
+ fi
+ printf ' WHERE `build_slaves`.`currently_building` IS NULL'
+ printf ' AND `build_slaves`.`logged_lines` IS NOT NULL;\n'
# remove obsolete file_providers
printf '%s FROM `file_providers`' \
"${operator}"