Skip to content

feat: persist rec/update jobs in a SQLite outbox - #11

Closed
kinton wants to merge 2 commits into
mainfrom
cursor/send-outbox-d56e
Closed

feat: persist rec/update jobs in a SQLite outbox#11
kinton wants to merge 2 commits into
mainfrom
cursor/send-outbox-d56e

Conversation

@kinton

@kinton kinton commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What

A process restart used to drop pending episode sends and user-triggered feed updates: they lived only in queue.Queue inside RecordBalancer.

send_outbox stores a JSON-safe rec / update payload (pendingleaseddone / failed). The in-memory balancer is still used in-process; on start expired/forced leases are reclaimed and pending rows are drained. Telegram upload/send logic is unchanged.

Details

  • Table created on SQLighter connect and in db/migrations/00013_send_outbox.py.
  • rec stores link / chat maps / podcastInfo. update stores chat_id, language_code, is_user_have_bot_subscription (no Telethon objects).
  • Claim uses BEGIN IMMEDIATE. After 8 attempts the row is failed. FloodWait can delay available_at.
  • Start/deploy still python main.py / supervisorctl restart yourcast.

Tests

venv/bin/python db/test_send_outbox.py — temp file DB only.

Left alone

ETag (PR #9), Bot API polling (PR #5), process supervisor (PR #7).

Open in Web Open in Cursor 

@kinton
kinton marked this pull request as ready for review September 3, 2026 10:40
cursoragent and others added 2 commits September 3, 2026 15:40
User-triggered episode sends and feed updates lived only in memory
queues, so a restart dropped them. Store JSON-safe payloads in
send_outbox, claim/lease them into the existing balancer, and restore
pending rows on process start.

Co-authored-by: Kovalenko K. <kintonkk@gmail.com>
Startup reclaim+drain would otherwise pick up a row already claimed
onto the memory queue and send it twice. Leave rows pending until
RecordBalancer has finished restoring the outbox.

Co-authored-by: Kovalenko K. <kintonkk@gmail.com>
@kinton

kinton commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #12: outbox is on top of #9, with lease heartbeat, in-flight skip, and user/creator notify after 8 failed attempts.

@kinton kinton closed this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants