forked from mtusi2026/mtusi2026lab5
ЛР5: асинхронная обработка вложений (RabbitMQ + worker), transactional outbox, варианты, трек 5.1
This commit is contained in:
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
# Stop exactly ONE API replica and leave it stopped.
|
||||
#
|
||||
# TARGET_INSTANCE_ID is the X-Instance-Id observed by the test, which equals the
|
||||
# replica's container hostname (Docker's short container id). We map it to the
|
||||
# running api container and stop it with a short grace period so the hook
|
||||
# returns well within the 10 second budget. PostgreSQL, Valkey and the balancer
|
||||
# are never touched.
|
||||
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
target=""
|
||||
for id in $(docker ps --filter "label=com.docker.compose.service=api" --format '{{.ID}}'); do
|
||||
case "$id" in
|
||||
"$TARGET_INSTANCE_ID"*) target="$id" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$target" ]; then
|
||||
echo "no running API replica matches X-Instance-Id=$TARGET_INSTANCE_ID" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker stop -t 5 "$target" >/dev/null
|
||||
exit 0
|
||||
Reference in New Issue
Block a user