diff options
author | Erich Eckner <git@eckner.net> | 2018-03-27 08:50:52 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-03-27 08:50:52 +0200 |
commit | 9e37d9e6cd70e6e7ddc4b48d7056c45342555ad6 (patch) | |
tree | 19a412f4e06a2e4b1d0261d03d7f93c66f1f4596 | |
parent | e29160ea07a7eb89d36aa741084b8cf6ee206bea (diff) | |
download | builder-9e37d9e6cd70e6e7ddc4b48d7056c45342555ad6.tar.xz |
lib/mysql-functions: mysql_cleanup: remove build assignments from build slaves which have not connected within the last hour
-rwxr-xr-x | lib/mysql-functions | 8 |
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 } |