From 9e37d9e6cd70e6e7ddc4b48d7056c45342555ad6 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 27 Mar 2018 08:50:52 +0200 Subject: lib/mysql-functions: mysql_cleanup: remove build assignments from build slaves which have not connected within the last hour --- lib/mysql-functions | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') 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 } -- cgit v1.2.3-70-g09d2