tgcf icon indicating copy to clipboard operation
tgcf copied to clipboard

Handle flood wait errors when sending messages in tgcf live mode

Open aahnik opened this issue 4 years ago • 0 comments

Problem

Flood waits must be handled here. There are certain use cases, where a huge no of messages are appearing in a large group. And if you are live syncing that, you may soon run into flood wait errors. What happens is that during the time of wait, messages are missed.

Current Code

https://github.com/aahnik/tgcf/blob/3d47c46007ca6bedc1e9766dc482c4fde29cd5b3/tgcf/utils.py#L19-L30

Plan

The message objects received by my send_message should be stored in a queue. Once sent they should be cleared from the queue. When flood wait is encountered, messages will accumulate in the queue. When traffic will be low, sometime in the future, the queue will get completely cleared. This mechanism will prevent missing messages.

aahnik avatar Jun 13 '21 13:06 aahnik