Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/mysql-functions8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 15729fb..129a20f 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -867,6 +867,14 @@ mysql_cleanup() {
mysql_join_binary_packages_repositories
printf ' SET `currently_building`=NULL'
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'
+ 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'
} | \
mysql_run_query
}