max-telegram-bridge-bot/migrations/postgres/000005_add_send_queue.up.sql
Andrey Lugovskoy 528d5afce5
All checks were successful
Build / build (push) Successful in 2m15s
Add retry queue for failed message delivery
Messages that fail to send to MAX are saved to DB and retried
automatically every 10s with exponential backoff (10s→30s→1m→2m).
Max 20 attempts or 30 min age, then dropped with notification.

Also: /whoami command, circuit breaker notifications, 15s HTTP timeout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:30:09 +03:00

15 lines
510 B
SQL

CREATE TABLE IF NOT EXISTS send_queue (
id SERIAL PRIMARY KEY,
direction TEXT NOT NULL,
src_chat_id BIGINT NOT NULL,
dst_chat_id BIGINT NOT NULL,
src_msg_id TEXT NOT NULL DEFAULT '',
text TEXT NOT NULL DEFAULT '',
att_type TEXT NOT NULL DEFAULT '',
att_token TEXT NOT NULL DEFAULT '',
reply_to TEXT NOT NULL DEFAULT '',
format TEXT NOT NULL DEFAULT '',
attempts INTEGER NOT NULL DEFAULT 0,
created_at BIGINT NOT NULL,
next_retry BIGINT NOT NULL DEFAULT 0
);