feat(scheduler,conversations,api): cron and schedule in the gateway tz, job runs persisted

This commit is contained in:
hh committed 2026-09-01 23:13:17 +02:00
1 parent 9b1127acff
commit 1954a6e9f2
10 files changed
+326 -43

No files matched your search

+27
View File
@@ -360,6 +360,32 @@ class RateLimit(SQLModel, table=True):
)
class JobRunRecord(SQLModel, table=True):
"""One finished run of a scheduler job (§3.6): what fired it, how it ended.
``error`` keeps the head of the traceback of a failed run; ``payload``
is the trigger's data (``{}`` for cron) and should stay small.
"""
__tablename__ = "job_runs"
id: int | None = Field(default=None, primary_key=True)
job: str = Field(index=True)
trigger: str
started_at: datetime
finished_at: datetime
status: str
error: str | None = Field(default=None)
payload: dict[str, Any] = Field(
default_factory=dict,
sa_column=Column(
JSON().with_variant(JSONB(), "postgresql"),
nullable=False,
server_default=text("'{}'"),
),
)
__all__ = [
"AuditLog",
"Conversation",
@@ -367,6 +393,7 @@ __all__ = [
"ConversationMessage",
"Delivery",
"InjectQueueItem",
"JobRunRecord",
"RateLimit",
"TelegramUpdate",
"Token",