td icon indicating copy to clipboard operation
td copied to clipboard

how forcefully receive updated info on getuser call?

Open ghost opened this issue 2 months ago • 10 comments

if i call getuser on a userid and that user later changes emoji status, and I call getuser again its being cached (just like the chatIds and getChats/LoadChats, for some reason they always return old chats lists until I remove db.sqlie file), so i never receive the new status.

how can we mitigate this?

ghost avatar Oct 19 '25 10:10 ghost

@levlam

ghost avatar Oct 20 '25 12:10 ghost

It is impossible to know up-to-date status of all other Telegram users or any other information about them. The cached information is updated whenever appropriate, usually, after some interaction with the user.

levlam avatar Oct 20 '25 19:10 levlam

never asked for "up to date status of all other telegram users", context is get user, so it must be related to that, im speaking here about the caching issue tdlib's get user creates, it will serve me with old ass info until i delete db.sqlite and re-run get user to get fresh info, its not telegram issue, its tdlib caching issue, once again, can't you add local: boolean in getUser wrapper to force the request sent to server?

The cached information is updated whenever appropriate, usually, after some interaction with the user.

tell me whats considered "some intearction with the user", the point is getUser must be considered as an interaction with user (since it works as "Open this user's profile"), what other methods other than send message/openChat can I use to force it to get updated?

ghost avatar Oct 23 '25 12:10 ghost

Regular apps never need to voluntary update basic information about a user, therefore it doesn't make sense to add such parameter to getUser.

Almost any interaction with the user is counted as "some intearction with the user", including opening of the chat in some cases.

levlam avatar Oct 23 '25 21:10 levlam

so how come "regular apps" aka normal telegram android updates user's bio as soon as i open profile and telegram x (which uses tdlib) doesnt, dont you think that's a misconception from the tdlib's side? now think about user statuses, emoji statuses and many more, not mentioning profile photos because they got their own method, but usernames and other fields get insta updated on telegram android and telegram desktop as soon as i open profile of user, so tell me why does tdlib think it should act different lol?

Almost any interaction with the user is counted as "some intearction with the user", including opening of the chat in some cases.

opening chat with user isn't the solution (many unmentioned moments), so what's the "almost any interaction" in our case besides opening chat with user or sending the user a message? i want to know to trigger

ghost avatar Oct 24 '25 02:10 ghost

Everything works as intended in all apps. I can't mention all the ways, because there are dozens of them and most are out of the app's control.

levlam avatar Oct 24 '25 09:10 levlam

Mention something that doesnt include sending message opening chat, i need something to refresh cache before getuser call, i have same issue with get history or get chats (literally get chats/load chats bro LOL), i always receive old chats until i remove fucking db and fetch them again when i dont use tdlib's session for a while

ghost avatar Oct 24 '25 11:10 ghost

There is no intended way to force such update. The cached information is updated whenever appropriate.

levlam avatar Oct 24 '25 13:10 levlam

you are acting like a broken record, you repeated it twice already

so how do i show new chats to the client other than deleting db.sqlite before app starts?

how do i show client fresh updater user profile using tdlib? or do official apps (aka telegram X) do not need it?

ghost avatar Oct 24 '25 14:10 ghost

TDLib always returns the newest possible data. There is no need to do anything.

levlam avatar Oct 24 '25 16:10 levlam