Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack for undelivered messages #1

Closed
lwl12 opened this issue Dec 18, 2017 · 3 comments
Closed

Stack for undelivered messages #1

lwl12 opened this issue Dec 18, 2017 · 3 comments

Comments

@lwl12
Copy link

lwl12 commented Dec 18, 2017

Create a queue for all undelivered messages, have a thread in parallel that checks if if there is message in the queue in a fixed in a fixed interval. If found, dequeue and resend, enqueue it back when failed.

Original content (chatlog) liwanglin12 Unofficial: @blueset 话说

telegram 服务器临时连接不上造成的丢消息

能重发么

Eana Hufwe:
目前是使用的 PTB 的5次重试策略

5次重试都不行就输出到 log

liwanglin12 Unofficial:
感觉能不能有一个机制

比如定期检测一下连通性

(比如利用updates

这个五次重试不行的

拉个库存起来

一旦链接恢复就重发

另外给main.py加一个让他重发的能力

主动重连

Eana Hufwe:
倒是可以搞一个 stack 隔一段时间检查一次

nice idea

到 ETM v2 repo 丢一个 issue 吧(俺可能会忘……((

话说这个「主动重连」是什么意思

liwanglin12 Unofficial:
比如 python3 main.py command updateetm

Eana Hufwe:
哦哦

@blueset blueset changed the title 到 ETM v2 repo 丢一个 issue 吧(俺可能会忘……(( Stack for undelivered messages Jan 4, 2018
@blueset
Copy link
Member

blueset commented Feb 9, 2018

Trying to implement a decorator that put an infinite retry every 1 to 2 seconds to all major outgoing message requests (excluding polling).

@blueset
Copy link
Member

blueset commented Mar 14, 2018

Due to strange network problems, in a consecutive period of time, messages may appear "not delivered" by returning an HTTP Timed Out response, but is in fact sent. This causes messages to be sent infinitely and potentially triggers Telegram's Spam filter. So this feature is turned off by default to prevent such issue to happen.

@blueset
Copy link
Member

blueset commented Jan 31, 2020

I have written an article explaining how difficult to solve this issue on the current architecture due to constraints of the Telegram Bot API.

I would only see this might have improvement if we migrate to MTProto API which could resolve some (but not all) of the issue we have there. Migration to MTProto is possible in the future (together with framework-wide support to Python async) but I don’t currently have any plan on it.

@blueset blueset closed this as completed Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants