Prioritize realtime news and make historical backfill resumable
Development CI / check-and-build (push) Successful in 3m0s
GitHub Git mirror / mirror (push) Successful in 5s
Development CI / deploy-development (push) Successful in 14m7s

This commit is contained in:
eezd committed 2026-11-06 14:28:39 +08:00
1 parent c90691d9a0
commit 5f347f8ab4
17 files changed
+697 -143

No files matched your search

@@ -0,0 +1,24 @@
"""Persist realtime boundaries and enforce one active call per subject."""
from alembic import op
import sqlalchemy as sa
revision = 'dd4567890123'
down_revision = 'dc3456789012'
branch_labels = None
depends_on = None
def upgrade():
op.add_column('news_research_settings', sa.Column('realtime_from', sa.DateTime(timezone=True)))
op.add_column('news_research_events', sa.Column('realtime_pending', sa.Boolean(), nullable=False, server_default=sa.false()))
op.create_index('uq_news_attempt_active', 'news_research_attempts', ['package_id'], unique=True,
postgresql_where=sa.text("state = 'processing'"))
op.create_index('uq_news_version_active', 'news_research_versions', ['event_id'], unique=True,
postgresql_where=sa.text("state = 'processing'"))
def downgrade():
op.drop_index('uq_news_version_active', table_name='news_research_versions')
op.drop_index('uq_news_attempt_active', table_name='news_research_attempts')
op.drop_column('news_research_events', 'realtime_pending')
op.drop_column('news_research_settings', 'realtime_from')