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

Fetching updates that arrived while the client was offline #263

Open
delivrance opened this issue Jun 30, 2019 · 6 comments
Open

Fetching updates that arrived while the client was offline #263

delivrance opened this issue Jun 30, 2019 · 6 comments

Comments

@delivrance
Copy link
Member

@delivrance delivrance commented Jun 30, 2019

Currently, Pyrogram will ignore all the updates that arrived while a client was offline, that is, a client that was manually stopped (in case of internal reconnections the missing updates are already correctly retrieved). Official documentation here https://core.telegram.org/api/updates.

@djumpen
Copy link

@djumpen djumpen commented Jul 3, 2019

I noticed Client stops receiving raw_updates after some time. No exception or error was produced.
Can you help with it? Maybe I need to set logs somewhere to see what happening?

@djumpen
Copy link

@djumpen djumpen commented Jul 3, 2019

It happens only in day time, when lot of events received. At night it works fine

app = Client("my_account", api_id, api_hash)
@app.on_message()
def my_handler(client, message):
    print(message)
    
app.run()

Maybe some type of ping needed? Really need it to be working

@delivrance
Copy link
Member Author

@delivrance delivrance commented Jul 4, 2019

@djumpen did this happen to you only lately? Can you tell me exactly when you noticed this (date and time)? Or is it a recurring issue?

@delivrance
Copy link
Member Author

@delivrance delivrance commented Jul 9, 2019

@djumpen Looks like something changed server side starting from Layer 102 because me, you and some other people already experienced and reported the same issue these days.

In details: the problem is that Telegram stops sending updates for some reason, but the underlying TCP socket and the MTProto connection are working fine. How do I know? There's already a ping mechanism implemented to keep the connection alive and iptraf reveals packets are being sent correctly. Moreover, I managed to inject a GetState request to the running process using pyrasite which made the server start sending updates again, without having to restart the script. This proves that Pyrogram has no important bug, it rather has a missing piece for handling such cases automatically, which should be added asap.

Thanks for the feedback anyway!

@drizzt
Copy link

@drizzt drizzt commented Nov 20, 2020

Any news about that topic?
I can sponsor this feature if needed, but I'd like to avoid losing events when I update/restart the script or stops receiving raw_updates after some time

@Tenount
Copy link

@Tenount Tenount commented Dec 8, 2020

Any news about that topic?
I can sponsor this feature if needed, but I'd like to avoid losing events when I update/restart the script or stops receiving raw_updates after some time

I don't think anyone cares. I tried to do it for personal purposes, but I gave up for now.

In fact, you only need to store the latest state data, compare this with the getState on Client run and so on updates to call updates.getDifference. And make some changes in session.py to able capture this type of updates in case raw.types.RpcResult are skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.