feat: add scheduler and mail outbox
SMTP adapter with TLS and a fake, outbox with retries, backoff, rate limit and restart safety, scheduler tick with job-run records started by gunicorn, and a send_test_mail command. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N3t4WL7bd9bdHHNjEsxzqC
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class JobRun(models.Model):
|
||||
"""The record of one run of one job. Owned by `scheduler` (AD-19)."""
|
||||
|
||||
class Status(models.TextChoices):
|
||||
RUNNING = "running"
|
||||
OK = "ok"
|
||||
ERROR = "error"
|
||||
|
||||
job = models.CharField(max_length=60)
|
||||
started_at = models.DateTimeField()
|
||||
finished_at = models.DateTimeField(null=True, blank=True)
|
||||
status = models.CharField(max_length=10, choices=Status.choices, default=Status.RUNNING)
|
||||
# A short summary, or the name of the error. Never personal content.
|
||||
detail = models.CharField(max_length=200, blank=True)
|
||||
|
||||
class Meta:
|
||||
indexes = [models.Index(fields=["job", "-started_at"])]
|
||||
ordering = ["-started_at", "-id"]
|
||||
Reference in New Issue
Block a user