tamed: Do not inject unexpected exit on explicit reload request

When the client requests a reload (e.g. on ACK wait failure), we should not
terminate, since we are expecting to attempt the request again.

This was broken by the previous commit.

DEV-10806
main
Mike Gerwitz 2023-10-03 15:37:25 -04:00
parent fb5947d59e
commit 3fad6c6375
1 changed files with 23 additions and 5 deletions

View File

@ -145,7 +145,7 @@ spawn-runner()
# available); let's act on its behalf so that the client sees that we # available); let's act on its behalf so that the client sees that we
# failed (which we'll represent with error code 2). # failed (which we'll represent with error code 2).
declare -i busy=$(< "$base/busy") declare -i busy=$(< "$base/busy")
if runner-is-busy "$base"; then if runner-is-busy "$base" && ! runner-is-reloading; then
inject-runner-unexpected-exit "$base" "$id" inject-runner-unexpected-exit "$base" "$id"
fi fi
@ -154,10 +154,7 @@ spawn-runner()
date +%s > "$base/created-ts" date +%s > "$base/created-ts"
"$mypath/dslc" < "$base/0" &> "$base/1" & job=$! "$mypath/dslc" < "$base/0" &> "$base/1" & job=$!
runner-done-reloading
# this flag is set by the `tame` client so that it knows when the
# runner becomes available
rm -f "$base/reloading"
declare -i status=0 declare -i status=0
wait "$job" 2>/dev/null || status=$? wait "$job" 2>/dev/null || status=$?
@ -188,6 +185,27 @@ runner-is-busy() {
} }
# Whether the runner at the provided base is flagged as having a reload
# request
runner-is-reloading() {
local -r base="$root/$id"
test -f "$base/reloading"
}
# Clear the runner's `reloading` flag, if any.
#
# This flag is set by the `tame` client before requesting a
# reload. Clearing this flag allows the client to observe that reloading
# the runner is complete and requests may be issued.
runner-done-reloading() {
local -r base="$root/$id"
rm -f "$base/reloading"
}
# Inject an exit code into the runner's output stream indicating an # Inject an exit code into the runner's output stream indicating an
# unexpected exit # unexpected exit
# #