feat(rss): add connection status tracking and display

Track RSS feed reachability during refresh cycles. Each feed now stores
connection_status (healthy/error), last_checked_at, and last_error.
The RSS management page shows a green "Connected" tag for healthy feeds
and a red "Error" tag with tooltip for failed feeds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Estrella Pan
2026-01-24 21:45:04 +01:00
parent cba4988e52
commit c5f4919e15
8 changed files with 80 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ from .user import UserDatabase
logger = logging.getLogger(__name__)
# Increment this when adding new migrations to MIGRATIONS list.
CURRENT_SCHEMA_VERSION = 1
CURRENT_SCHEMA_VERSION = 2
# Each migration is a tuple of (version, description, list of SQL statements).
# Migrations are applied in order. A migration at index i brings the schema
@@ -26,6 +26,15 @@ MIGRATIONS = [
"add air_weekday column to bangumi",
["ALTER TABLE bangumi ADD COLUMN air_weekday INTEGER"],
),
(
2,
"add connection status columns to rssitem",
[
"ALTER TABLE rssitem ADD COLUMN connection_status TEXT",
"ALTER TABLE rssitem ADD COLUMN last_checked_at TEXT",
"ALTER TABLE rssitem ADD COLUMN last_error TEXT",
],
),
]
@@ -88,6 +97,10 @@ class Database(Session):
columns = [col["name"] for col in inspector.get_columns("bangumi")]
if "air_weekday" in columns:
needs_run = False
if "rssitem" in tables and version == 2:
columns = [col["name"] for col in inspector.get_columns("rssitem")]
if "connection_status" in columns:
needs_run = False
if needs_run:
with self.engine.connect() as conn:
for stmt in statements: