fix: quiet ps:retire where possible
Log output for ps:retire was previously a bit too verbose because we weren't handling the following edge-cases. - if a container doesn't exist, remove it from the dead container list - ensure a restarting container is properly killed - only attempt to stop/kill if the state is not dead or exited - do not attempt to do anything if the container doesn't exist - correct check on running state
This commit is contained in:
1 parent
49af2d8062
commit
0375bc3e97
2 files changed
+33
-12
No files matched your search
@@ -9,7 +9,7 @@ scheduler-docker-local-scheduler-retire() {
|
||||
declare trigger="scheduler-docker-local scheduler-retire"
|
||||
|
||||
local DEAD_CONTAINER_FILE="${DOKKU_LIB_ROOT}/data/scheduler-docker-local/dead-containers"
|
||||
local APP CID CURRENT_TIME DEAD_TIME
|
||||
local APP CID CURRENT_TIME DEAD_TIME STATE
|
||||
|
||||
if [[ ! -f "$DEAD_CONTAINER_FILE" ]]; then
|
||||
return
|
||||
@@ -27,7 +27,13 @@ scheduler-docker-local-scheduler-retire() {
|
||||
fi
|
||||
|
||||
fn-scheduler-docker-local-retire-container "$APP" "$CID" "$DEAD_TIME"
|
||||
if docker ps -aq -f "id=${CID}" -f "status=running" >/dev/null 2>&1; then
|
||||
STATE="$(docker inspect -f "{{ .State.Status }}" "$CID" 2>/dev/null || true)"
|
||||
if [[ -z "$STATE" ]]; then
|
||||
DEAD_CONTAINERS+=("$CID")
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ "$STATE" == "running" ]]; then
|
||||
dokku_log_warn "Container ${CID} still running"
|
||||
continue
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user