Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/ping-from-slave39
1 files changed, 24 insertions, 15 deletions
diff --git a/bin/ping-from-slave b/bin/ping-from-slave
index 80ec46a..3c03b45 100755
--- a/bin/ping-from-slave
+++ b/bin/ping-from-slave
@@ -26,12 +26,20 @@ fi
log_lines=$(cat)
-if [ -n "${log_lines}" ]; then
- # shellcheck disable=SC2016
- {
- printf 'UPDATE `build_slaves`'
- printf ' SET `build_slaves`.`logged_lines`=from_base64("%s")' \
+# shellcheck disable=SC2016
+{
+ printf 'UPDATE `build_slaves`'
+ printf ' SET'
+ printf ' `build_slaves`.`last_action`=from_base64("%s")' \
+ "$(
+ printf '%s' "$1" | \
+ base64 -w0
+ )"
+
+ printf ', `build_slaves`.`logged_lines`='
+ if [ -n "${log_lines}" ]; then
+ printf 'from_base64("%s")' \
"$(
printf '%s' "$((
$(
@@ -41,13 +49,14 @@ if [ -n "${log_lines}" ]; then
)0))" | \
base64 -w0
)"
- printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \
- "$(
- printf '%s' "${slave}" | \
- base64 -w0
- )"
- } | \
- tee /tmp/ping-from-slave.query | \
- mysql_run_query 'unimportant'
-
-fi
+ else
+ printf 'NULL'
+ fi
+
+ printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \
+ "$(
+ printf '%s' "${slave}" | \
+ base64 -w0
+ )"
+} | \
+ mysql_run_query 'unimportant'