perf: SQLite WAL + 复合索引 + GZip + scheduler jitter + 构建缓存

This commit is contained in:
SmartUp Developer
2026-05-25 00:08:10 +08:00
parent 3a31d185a4
commit 41a439d830
10 changed files with 77 additions and 8 deletions
+6 -1
View File
@@ -1,7 +1,7 @@
from datetime import datetime, timezone
from typing import Optional
from sqlalchemy import Boolean, DateTime, ForeignKey, Integer, String, Text
from sqlalchemy import Boolean, DateTime, ForeignKey, Index, Integer, String, Text, text
from sqlalchemy.orm import Mapped, mapped_column
from app.database import Base
@@ -66,3 +66,8 @@ class WebsiteSyncLog(Base):
status: Mapped[str] = mapped_column(String(16), nullable=False)
message: Mapped[str] = mapped_column(Text, default="")
created_at: Mapped[datetime] = mapped_column(DateTime, default=lambda: datetime.now(timezone.utc), index=True)
__table_args__ = (
Index("ix_sync_website_created", "website_id", text("created_at DESC")),
Index("ix_sync_binding_created", "binding_id", text("created_at DESC")),
)