Repository navigation
Unsubscribe subscribers whose Telegram account is gone - #17
Merged
Merged
Conversation
|
Queued — the merge queue status continues in this comment ↓. |
Co-authored-by: Lin Yinfeng <lin.yinfeng@outlook.com>
littlenano
force-pushed
the
sweep-gone-subscribers
branch
from
October 22, 2026 06:53
a66e413 to
4c69e9b
Compare
Merge Queue Status
This pull request spent 1 minute 19 seconds in the queue, including 36 seconds running CI. Required conditions to merge
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The subscriber sweep drops subscribers whose
get_chat_memberreportsuser not found. An id Telegram cannot resolve as a chat participant also surfaces aswhich is an
ApiError::Unknown(teloxide has no variant for it), so it was only logged as a warning on every update while the subscriber stayed subscribed forever.What the error means
PARTICIPANT_ID_INVALIDas "The specified participant ID is invalid", raised bychannels.getParticipant, the MTProto method behindgetChatMember.{user_id, chat_id}pairs that are entirely valid, sometimes returningleftfor the same request minutes later, and one report ties it to users the bot never interacted with and therefore cannot resolve.Either way the id cannot resolve as a member of the chat, so it cannot be mentioned there: keeping the subscription changes nothing.
sweep_subscribers()therefore treats it likeuser not foundand removes the subscriber with aninfolog instead of a warning.Other API errors (chat not found, retry after, network, …) still keep the subscriber and warn, and a member status that is simply not a member was already handled by
is_member().Verification
cargo test --all-targets: 9 passed (the sweep mechanics are covered byupdate_subscribers_removes_invalid_and_renames; the error classification is a two-line match, not worth a test that would only restate the constant)cargo clippy --all-targets,cargo fmt --check: cleanmain(post dependency update, rustc 1.99.0):cargo check --all-targetsclean,cargo test14 passed