mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Merge pull request #5057 from dokku/fix-wait
Ensure we use the correct variable for WAIT
This commit is contained in:
@@ -17,7 +17,7 @@ main() {
|
||||
dokku_log_verbose "Stopping $cid ($PROC_TYPE)"
|
||||
|
||||
# Retire the containers to ensure they get removed
|
||||
plugn trigger scheduler-register-retired "$APP" "$cid" "$WAIT"
|
||||
plugn trigger scheduler-register-retired "$APP" "$cid" "$DOKKU_WAIT_TO_RETIRE"
|
||||
|
||||
# Disable the container restart policy
|
||||
"$DOCKER_BIN" container update --restart=no "$cid" &>/dev/null || true
|
||||
|
||||
@@ -32,7 +32,6 @@ main() {
|
||||
local DOKKU_PORT=""
|
||||
if [[ "$PROC_TYPE" == "web" ]]; then
|
||||
ports=($(plugn trigger network-compute-ports "$APP" "$PROC_TYPE" "$DOKKU_HEROKUISH" "$CONTAINER_INDEX"))
|
||||
local DOKKU_DOCKER_PORT_ARGS=""
|
||||
for p in "${ports[@]}"; do
|
||||
if [[ ! "$p" =~ .*udp.* ]]; then
|
||||
DOKKU_PORT=${DOKKU_PORT:="$p"}
|
||||
@@ -64,7 +63,7 @@ main() {
|
||||
declare desc="wrapper function to kill newly started app container"
|
||||
declare CID="$1" PROC_TYPE="$2" CONTAINER_INDEX="$3"
|
||||
|
||||
plugn trigger scheduler-register-retired "$APP" "$CID" "$WAIT"
|
||||
plugn trigger scheduler-register-retired "$APP" "$CID" "$DOKKU_WAIT_TO_RETIRE"
|
||||
mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP"
|
||||
echo "${CID} ${PROC_TYPE}.${CONTAINER_INDEX}" >>"${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP/failed-containers"
|
||||
"$DOCKER_BIN" container inspect "$CID" &>/dev/null && {
|
||||
@@ -86,8 +85,8 @@ main() {
|
||||
|
||||
if [[ -f "$DOKKU_CONTAINER_ID_FILE" ]]; then
|
||||
# schedule old container for retirement
|
||||
dokku_log_verbose "Scheduling old container shutdown in $WAIT seconds ($PROC_TYPE.$CONTAINER_INDEX)"
|
||||
plugn trigger scheduler-register-retired "$APP" "$(cat "$DOKKU_CONTAINER_ID_FILE")" "$WAIT"
|
||||
dokku_log_verbose "Scheduling old container shutdown in $DOKKU_WAIT_TO_RETIRE seconds ($PROC_TYPE.$CONTAINER_INDEX)"
|
||||
plugn trigger scheduler-register-retired "$APP" "$(cat "$DOKKU_CONTAINER_ID_FILE")" "$DOKKU_WAIT_TO_RETIRE"
|
||||
fi
|
||||
|
||||
# now using the new container
|
||||
|
||||
@@ -43,7 +43,7 @@ trigger-scheduler-docker-local-scheduler-deploy() {
|
||||
local DOKKU_WAIT_TO_RETIRE=${DOKKU_APP_DOKKU_WAIT_TO_RETIRE:="$DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE"}
|
||||
fi
|
||||
|
||||
local WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
|
||||
export DOKKU_WAIT_TO_RETIRE="${DOKKU_WAIT_TO_RETIRE:-60}"
|
||||
|
||||
local TMP_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
|
||||
trap "rm -rf '$TMP_FILE' >/dev/null" RETURN INT TERM
|
||||
@@ -78,11 +78,11 @@ trigger-scheduler-docker-local-scheduler-deploy() {
|
||||
# kill the old container
|
||||
if [[ -n "$oldids" ]]; then
|
||||
# Let the old container finish processing requests, before terminating it
|
||||
dokku_log_info1 "Shutting down old containers in $WAIT seconds"
|
||||
dokku_log_info1 "Shutting down old containers in $DOKKU_WAIT_TO_RETIRE seconds"
|
||||
(
|
||||
exec >/dev/null 2>/dev/null </dev/null
|
||||
trap '' INT HUP
|
||||
sleep "$WAIT"
|
||||
sleep "$DOKKU_WAIT_TO_RETIRE"
|
||||
for oldid in $oldids; do
|
||||
if ! docker container inspect "$oldid" >/dev/null 2>&1; then
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user