Skip to main content

Module poller

Module poller 

Source
Expand description

Telegram long-polling loop: getUpdates → dispatch → offset advance; outbound mpsc → REST send. Plays the same role as discord::gateway::run_gateway_loop, but with no session/resume state — long polling has no connection to lose beyond a single HTTP request, so this is a plain retry-forever loop around one HTTP GET.

Constants§

CHAT_MIN_SPACING 🔒
Minimum spacing between two outbound sends to the same chat (spec §2.5 — “1 msg/second” limit, enforced with a bit of headroom).
MAX_RECONNECT_DELAY_SECS 🔒
RECONNECT_DELAY_SECS 🔒

Functions§

handle_outbound 🔒
handle_update 🔒
Filters, envelopes, and injects one inbound update. Plays the same role as gateway.rs’s handle_dispatch for MESSAGE_CREATE.
jitter 🔒
Cheap jitter (0-300ms) without pulling in a rand dependency — derived from the current time’s sub-second nanoseconds.
resolve_chat_id 🔒
Resolves an OutboundMsg.channel_id (a stringified chat id, or empty for “use the bridge’s default”) into a Telegram numeric chat id.
run_inbound_loop 🔒
run_outbound_loop 🔒
run_poll_loop
Runs the inbound long-poll loop and the outbound send loop as two fully independent tasks (tokio::join!, not tokio::select! on a shared loop iteration).
unix_secs 🔒