Files
Auto_Bangumi/entrypoint.sh
Estrella Pan 98e016ce2e fix: apply architecture-review fixes P2-P10 across update, downloader, core, parser, webui
- update: snapshot DB before promote; rollback restores it only when the
  schema actually advanced, never from a stale on-disk fallback; snapshots
  are standalone (no WAL sidecars); dependency sync moved to apply time
  with a staged venv, plus boot-time venv reconcile after rollback;
  entrypoint restart loop forwards signals so docker stop stays graceful
- downloader: AddResult carried through the client protocol; qB "Fails."
  only classified duplicate when the magnet hash is confirmed present;
  aria2 partial-success batches report ADDED, magnet followedBy gids are
  migrated and metadata stubs skipped in torrents_info; renamed paths
  persisted per gid so the rename loop converges
- core: AppContext lifecycle serialized under one lock with running state
  derived from the scheduler; setup wizard starts background loops on
  completion
- parser: LLM path gains episode_type classification (LLM results only),
  timeout/cache/concurrency/breaker controls, proxy-aware SDK clients
  closed after a grace period on config reload
- webui: useApi returns an {ok} discriminant; config save and RSS refresh
  surface failures instead of false success
- migrations: per-statement guards so a crash mid-migration recovers

Implemented via Codex (P2-P10 from tasks/todo.md), then reviewed with a
multi-agent verify pass; 10 confirmed review findings fixed on top.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FAxVyRwrY7z5NotTtgnwVs
2026-07-03 10:52:09 +02:00

47 lines
1.2 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# shellcheck shell=bash
umask ${UMASK}
if [ -f /config/bangumi.json ]; then
mv /config/bangumi.json /app/data/bangumi.json
fi
groupmod -o -g "${PGID}" ab
usermod -o -u "${PUID}" ab
# 重启循环让 shell 站在 tini 和应用之间,因此必须自己转发信号并等待
# 应用退出,否则 docker stop 时 shell 先死、tini 跟着退出,python 会被
# SIGKILL 打断(SQLite WAL 来不及落盘)。
child=""
forward_signal() {
if [ -n "${child}" ]; then
kill -TERM "${child}" 2>/dev/null
wait "${child}"
exit $?
fi
exit 0
}
trap forward_signal TERM INT
while true; do
# 应用持久卷中的在线更新覆盖层(在启动应用前、以 root 运行)。脚本内部已全程
# 兜底 try/except,这里再加 `|| true`:覆盖层失败绝不能阻断容器启动。
python /app/boot_overlay.py || true
chown ab:ab -R /app/data /app/config /home/ab
su-exec "${PUID}:${PGID}" python main.py &
child=$!
wait "${child}"
status=$?
child=""
if [ -f /app/config/updates/.restart ]; then
rm -f /app/config/updates/.restart
continue
fi
exit "${status}"
done