From 9b0c3a597a6421b318e34b46de2b991c84d22f2a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 17 Apr 2018 15:28:07 +0200 Subject: lib/mysql-functions: make last_connection obsolete --- lib/mysql-functions | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/mysql-functions b/lib/mysql-functions index c799877..048f163 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -880,7 +880,10 @@ mysql_cleanup() { 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' + printf ' AND TIMEDIFF(NOW(),(' + 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 if [ "${operator}" = 'DELETE' ]; then printf 'UPDATE `build_slaves`' @@ -1095,6 +1098,9 @@ mysql_join__generic() { } for link in \ + 'allowed_email_actions:action:email_actions' \ + 'allowed_email_actions:gpg_key:gpg_keys' \ + \ 'binary_packages:architecture:architectures' \ 'binary_packages:repository:repositories' \ 'binary_packages:build_assignment:build_assignments' \ @@ -1107,15 +1113,21 @@ for link in \ \ 'build_slaves:currently_building:build_assignments' \ 'build_slaves:currently_building build_assignment:binary_packages' \ + 'build_slaves:ssh_key:ssh_keys' \ \ 'dependencies:depending_on:install_targets' \ 'dependencies:dependent:binary_packages' \ 'dependencies:dependency_type:dependency_types' \ \ + 'email_log:action:email_actions' \ + 'email_log:gpg_key:gpg_keys' \ + \ 'failed_builds:reason:fail_reason' \ 'failed_builds:build_assignment:build_assignments' \ 'failed_builds:build_slave:build_slaves' \ \ + 'gpg_keys:owner:persons' \ + \ 'install_target_providers:package:binary_packages' \ 'install_target_providers:install_target:install_targets' \ 'install_target_providers:install_target depending_on:dependencies' \ @@ -1127,6 +1139,10 @@ for link in \ 'repository_moves:upstream_package_repository:upstream_repositories' \ 'repository_moves:upstream_package_repository upstream_package_repository:package_sources' \ \ + 'ssh_keys:owner:persons' \ + \ + 'ssh_log:build_slave:build_slaves' \ + \ 'upstream_repositories:git_repository:git_repositories'; do # A join for these cannot be done, because it's not clear on what to join: # 'repository_stability_relations:more_stable:repository_stabilities' -- cgit v1.2.3-70-g09d2