From 2944fd6d91d437147521c48b6c9d30ab50755152 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 1 Jun 2018 11:19:05 +0200 Subject: lib/mysql-functions, bin/return-assignment: keep build_slaves information synchronously up-to-date --- bin/return-assignment | 8 ++++++-- lib/mysql-functions | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/return-assignment b/bin/return-assignment index dcbd62e..2f05495 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -161,7 +161,9 @@ if [ "$5" = 'ERROR' ]; then printf 'COMMIT;\n' printf 'UPDATE `build_slaves`' printf ' SET `build_slaves`.`currently_building`=NULL,' - printf ' `build_slaves`.`logged_lines`=NULL' + printf ' `build_slaves`.`last_action`=NULL,' + printf ' `build_slaves`.`logged_lines`=NULL,' + printf ' `build_slaves`.`trials`=NULL' printf ' WHERE `build_slaves`.`id`=from_base64("%s");\n' \ "$( printf '%s' "${slave_id}" | \ @@ -645,7 +647,9 @@ trigger_mirror_refreshs # remove from build slave's `currently_building` printf 'UPDATE `build_slaves`' printf ' SET `build_slaves`.`currently_building`=NULL,' - printf ' `build_slaves`.`logged_lines`=NULL' + printf ' `build_slaves`.`last_action`=NULL,' + printf ' `build_slaves`.`logged_lines`=NULL,' + printf ' `build_slaves`.`trials`=NULL' printf ' WHERE `build_slaves`.`currently_building`=from_base64("%s");\n' \ "$( printf '%s' "${build_assignment_id}" | \ diff --git a/lib/mysql-functions b/lib/mysql-functions index cb76dac..2670c9b 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -900,17 +900,19 @@ mysql_cleanup() { printf 'SELECT MAX(`ssh_log`.`date`) FROM `ssh_log`' printf ' WHERE `ssh_log`.`build_slave`=`build_slaves`.`id`' printf ')) > "1:00:00";\n' - # remove `last_action` and `logged_lines` from buildslaves without an assignment + # remove `last_action`, `trials` and `logged_lines` from buildslaves without an assignment if [ "${operator}" = 'DELETE' ]; then printf 'UPDATE `build_slaves`' printf ' SET `build_slaves`.`last_action`=NULL,' - printf ' `build_slaves`.`logged_lines`=NULL' + printf ' `build_slaves`.`logged_lines`=NULL,' + printf ' `build_slaves`.`trials`=NULL' else printf 'SELECT COUNT(1) FROM `build_slaves`' fi printf ' WHERE `build_slaves`.`currently_building` IS NULL' printf ' AND (`build_slaves`.`last_action` IS NOT NULL' - printf ' OR `build_slaves`.`logged_lines` IS NOT NULL);\n' + printf ' OR `build_slaves`.`logged_lines` IS NOT NULL' + printf ' OR `build_slaves`.`trials` IS NOT NULL);\n' } | \ mysql_run_query 'unimportant' } -- cgit v1.2.3-70-g09d2