diff options
| author | Christian Cleberg <[email protected]> | 2026-04-11 18:45:54 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-11 18:45:54 -0500 |
| commit | 01c1b50541b0dc1d42cbdaa90052f6b94ceba20c (patch) | |
| tree | 5af4bd41d6497d4f49254690f97a39f387d7785b /src/srht_contrib/models.py | |
| parent | f0393a0b8d541df6b47bbeee6c4270ce8303bf18 (diff) | |
| download | hutch-stats-01c1b50541b0dc1d42cbdaa90052f6b94ceba20c.tar.gz hutch-stats-01c1b50541b0dc1d42cbdaa90052f6b94ceba20c.tar.bz2 hutch-stats-01c1b50541b0dc1d42cbdaa90052f6b94ceba20c.zip | |
feat: prioritize recent-window backfill before full history
Diffstat (limited to 'src/srht_contrib/models.py')
| -rw-r--r-- | src/srht_contrib/models.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/srht_contrib/models.py b/src/srht_contrib/models.py index a99a306..475bd22 100644 --- a/src/srht_contrib/models.py +++ b/src/srht_contrib/models.py @@ -71,6 +71,10 @@ class TrackedActor(Base): last_polled_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True) last_poll_status: Mapped[str | None] = mapped_column(String(32), nullable=True) last_poll_error: Mapped[str | None] = mapped_column(Text, nullable=True) + recent_backfill_status: Mapped[str] = mapped_column(String(32), nullable=False, default="pending") + recent_backfill_started_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True) + recent_backfill_completed_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True) + last_recent_backfill_error: Mapped[str | None] = mapped_column(Text, nullable=True) backfill_status: Mapped[str] = mapped_column(String(32), nullable=False, default="pending") backfill_started_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True) backfill_completed_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True) @@ -79,11 +83,12 @@ class TrackedActor(Base): class ServiceBackfillState(Base): __tablename__ = "service_backfill_states" - __table_args__ = (UniqueConstraint("actor", "service", name="uq_service_backfill_state_actor_service"),) + __table_args__ = (UniqueConstraint("actor", "service", "scope", name="uq_service_backfill_state_actor_service_scope"),) id: Mapped[int] = mapped_column(Integer, primary_key=True) actor: Mapped[str] = mapped_column(String(255), nullable=False) service: Mapped[str] = mapped_column(String(32), nullable=False) + scope: Mapped[str] = mapped_column(String(16), nullable=False, default="full") cursor_json: Mapped[dict | None] = mapped_column(JSON, nullable=True) status: Mapped[str] = mapped_column(String(32), nullable=False, default="pending") started_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True) |
