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

Is it possible to reduce delay receiving channel messages/updates? #275

Closed
NMishchenko opened this issue Aug 5, 2024 · 1 comment
Closed
Labels
question General question or discussion

Comments

@NMishchenko
Copy link

NMishchenko commented Aug 5, 2024

Hi.

I'm using UpdateManager to receive updates:
Manager = Client.WithUpdateManager(Client_OnUpdate);

My application needs to react to new channel messages as fast as possible, but UpdateNewChannelMessage can be received even 10 minutes after they were posted.
I saw InactivityThreshold property inside UpdateManager, so I changed it to 1 minute: Manager.InactivityThreshold = TimeSpan.FromMinutes(1) and now it receives updates guaranteed every minute.
I'm afraid that if I change that property to 1 second, the account with a bot can be banned.

I also noticed that updates from my test channel with 2 subscribers are received immediately without any delay every time, so this problem occurs only with big channels (200k-600k subscribers).

Can I improve something to make it faster or is it some Telegram limitation?

@wiz0u
Copy link
Owner

wiz0u commented Aug 6, 2024

On very large groups/channel, it has been observed that the same message may be received with a delay between a full client and WTelegramClient. That is not due to slowness in the library. It's Telegram servers taking the time to dispatch the updates among thousands of members.

According to someone, the priority order when dispatching such updates to group members could be something like this:
Replied person > Tagged people > Group Creator > Group admins > Recently active members > Everyone else
So maybe being admin or active poster in the group can help reduce the delay.

Increasing the default PingInterval may have negative effects.
Reducing Manager.InactivityThreshold can help, but if you reduce it too much, you might make the Manager crash as Telegram could reject the many Manager API calls with FLOOD_WAIT_X

@wiz0u wiz0u closed this as completed Aug 6, 2024
@wiz0u wiz0u added the question General question or discussion label Aug 6, 2024
@wiz0u wiz0u changed the title Is it possible to receive channel updates immediately? Is it possible to reduce delay receiving channel updates? Aug 6, 2024
@wiz0u wiz0u changed the title Is it possible to reduce delay receiving channel updates? Is it possible to reduce delay receiving channel messages/updates? Aug 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question General question or discussion
Projects
None yet
Development

No branches or pull requests

2 participants