Userge icon indicating copy to clipboard operation
Userge copied to clipboard

mongo storage to reduce PeerIdInvalid errors

Open rking32 opened this issue 4 years ago • 5 comments

Currently, all peer data are stored in the memory. Hence it is cleared in every restart. So better to save them in the database and fetch them when needed. With that, we can reduce PeerIdInvalid errors and increase user happiness :)

https://github.com/pyrogram/pyrogram/blob/master/pyrogram/storage/storage.py

rking32 avatar Jan 13 '22 15:01 rking32

🤧 what are you gonna do about Auth key duplication error?

Phyco-Ninja avatar Jan 17 '22 14:01 Phyco-Ninja

will it be hard to handle?

rking32 avatar Jan 17 '22 14:01 rking32

not really, all it will need is new authentication method, something like, it extracts auth_key, dc_id, user_id and other stuffs from given pyro session key and update that in Mongo Storage. If new authentication method is implement correctly you can move all env to a collection in database. Maybe play around with this Mongo Storage Base

bash setup kinda thing. 🤒

Phyco-Ninja avatar Jan 17 '22 14:01 Phyco-Ninja

NIce. it's very good.

rking32 avatar Jan 17 '22 15:01 rking32

PeerIdInvalid can also be reduce by using (link to profile) mention and extract user id from mention instead of using user id directly

Before I was also confused about this but after testing it's working and not won't raise PeerIdInvalid

Krishna-Singhal avatar Feb 06 '22 07:02 Krishna-Singhal