Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/mysql-functions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mysql-functions')
-rwxr-xr-xlib/mysql-functions30
1 files changed, 17 insertions, 13 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index c27babc..54de45e 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -1755,20 +1755,24 @@ mysql_query_ordering_correct() {
# active build slaves
mysql_determine_majority_build_slave_architecture_id() {
{
- printf 'SELECT'
- printf ' COUNT(DISTINCT `ssh_log`.`id`) AS `count`,'
- printf '`architectures`.`id`'
- printf ' FROM `ssh_log`'
- printf ' JOIN `architectures`'
- printf ' ON `ssh_log`.`parameters`=CONCAT(`architectures`.`name`," ")'
- printf ' WHERE `action`="get-assignment"'
- printf ' AND `ssh_log`.`date`>ADDTIME(NOW(),"-1 00:00:00")'
- printf ' GROUP BY `ssh_log`.`parameters`'
- printf ' ORDER BY `count` DESC'
- printf ' LIMIT 1'
+ {
+ printf 'SELECT'
+ printf ' COUNT(DISTINCT `ssh_log`.`id`) AS `count`,'
+ printf '`architectures`.`id`'
+ printf ' FROM `ssh_log`'
+ printf ' JOIN `architectures`'
+ printf ' ON `ssh_log`.`parameters`=CONCAT(`architectures`.`name`," ")'
+ printf ' WHERE `action`="get-assignment"'
+ printf ' AND `ssh_log`.`date`>ADDTIME(NOW(),"-1 00:00:00")'
+ printf ' GROUP BY `ssh_log`.`parameters`'
+ printf ' ORDER BY `count` DESC'
+ printf ' LIMIT 1'
+ } | \
+ mysql_run_query | \
+ cut -f2
+ echo '-1'
} | \
- mysql_run_query | \
- cut -f2
+ head -n1
}
# mysql_query_delete_packages $package_sources_condition $repositories_condition