Open ammarfaizi2 opened 3 years ago
Calling getChatAdministrators() every time privilege check is done is too expensive w.r.t. latency.
getChatAdministrators()
N
if (message_count % N == 0) { updateAdminCache(); } /* * Privilege check function */ bool checkPrivileged(uint64_t user_id, int64_t group_id) { if (checkPrivilegeFromCache(user_id, group_id)) return true; updateAdminCache(); return checkPrivilegeFromCache(user_id, group_id); }
Calling
getChatAdministrators()
every time privilege check is done is too expensive w.r.t. latency.Workaround
N
.Pseudo Code