forked from boos/BoosAPI
fix: stabilize Codex continuation and proxy retry recovery / 修复 Codex 续传与代理重试稳定性 (#257)
* wip: preserve local changes before upstream merge * Improve proxy routing stability and add stable-first strategy * Sync explicit-group routing strategy to eligible source routes * Fix proxy retry and runtime health review issues * fix: make proxy channel retry attempts configurable * fix: harden proxy retry recovery and bookkeeping * fix: address pr 257 review comments --------- Co-authored-by: Cita <juricek.chen@gmail.com>
This commit is contained in:
+33
-13
@@ -66,15 +66,21 @@ require_cmd docker
|
||||
require_cmd tar
|
||||
require_cmd git
|
||||
require_file "$COMPOSE_FILE"
|
||||
require_file "$COMPOSE_OVERRIDE_FILE"
|
||||
require_file "$ENV_FILE"
|
||||
|
||||
COMPOSE_ARGS=(
|
||||
-f "$COMPOSE_FILE"
|
||||
-f "$COMPOSE_OVERRIDE_FILE"
|
||||
--env-file "$ENV_FILE"
|
||||
)
|
||||
|
||||
if [ -f "$COMPOSE_OVERRIDE_FILE" ]; then
|
||||
COMPOSE_ARGS=(
|
||||
-f "$COMPOSE_FILE"
|
||||
-f "$COMPOSE_OVERRIDE_FILE"
|
||||
--env-file "$ENV_FILE"
|
||||
)
|
||||
fi
|
||||
|
||||
if [ "$DO_PULL" -eq 1 ]; then
|
||||
echo "[0/5] Checking git worktree..."
|
||||
if [ -n "$(git -C "$ROOT_DIR" status --porcelain)" ]; then
|
||||
@@ -89,36 +95,50 @@ else
|
||||
fi
|
||||
|
||||
BACKUP_FILE=""
|
||||
RESTORE_ON_ERROR=0
|
||||
|
||||
restore_if_failed() {
|
||||
if [ "$RESTORE_ON_ERROR" -eq 1 ]; then
|
||||
echo "Update failed after containers were stopped; attempting to restore service..." >&2
|
||||
docker compose "${COMPOSE_ARGS[@]}" up -d --force-recreate || true
|
||||
fi
|
||||
}
|
||||
|
||||
trap restore_if_failed ERR
|
||||
|
||||
if [ "$DO_PULL" -eq 1 ]; then
|
||||
echo "[2/5] Stopping current containers..."
|
||||
else
|
||||
echo "[2/4] Stopping current containers..."
|
||||
fi
|
||||
docker compose "${COMPOSE_ARGS[@]}" down --remove-orphans
|
||||
RESTORE_ON_ERROR=1
|
||||
|
||||
if [ "$SKIP_BACKUP" -eq 0 ]; then
|
||||
mkdir -p "$DATA_DIR"
|
||||
BACKUP_FILE="$ROOT_DIR/docker/data-backup-$(date +%Y%m%d-%H%M%S).tar.gz"
|
||||
if [ "$DO_PULL" -eq 1 ]; then
|
||||
echo "[2/5] Backing up data directory..."
|
||||
echo "[3/5] Backing up data directory..."
|
||||
else
|
||||
echo "[2/4] Backing up data directory..."
|
||||
echo "[3/4] Backing up data directory..."
|
||||
fi
|
||||
tar -czf "$BACKUP_FILE" -C "$DATA_DIR" .
|
||||
else
|
||||
if [ "$DO_PULL" -eq 1 ]; then
|
||||
echo "[2/5] Skipping data backup by request..."
|
||||
echo "[3/5] Skipping data backup by request..."
|
||||
else
|
||||
echo "[2/4] Skipping data backup by request..."
|
||||
echo "[3/4] Skipping data backup by request..."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$DO_PULL" -eq 1 ]; then
|
||||
echo "[3/5] Stopping current containers..."
|
||||
else
|
||||
echo "[3/4] Stopping current containers..."
|
||||
fi
|
||||
docker compose "${COMPOSE_ARGS[@]}" down --remove-orphans
|
||||
|
||||
if [ "$DO_PULL" -eq 1 ]; then
|
||||
echo "[4/5] Rebuilding and starting containers..."
|
||||
else
|
||||
echo "[4/4] Rebuilding and starting containers..."
|
||||
fi
|
||||
docker compose "${COMPOSE_ARGS[@]}" up -d --build --force-recreate
|
||||
RESTORE_ON_ERROR=0
|
||||
trap - ERR
|
||||
|
||||
echo
|
||||
echo "Container status:"
|
||||
|
||||
Reference in New Issue
Block a user