Send access hashes without checking if the database is enabled

This commit is contained in:
Andrea Cavalli 2021-08-23 20:57:36 +02:00
parent 0ee1d7edc1
commit 49bca76869
2 changed files with 10 additions and 9 deletions

View File

@ -28,11 +28,12 @@ We added some options:
* **delete_chat_reference_after_seconds** (positive number) During cleanup, free the memory of the chats that have not been touched for more than X seconds
* **delete_user_reference_after_seconds** (positive number) During cleanup, free the memory of the users that have not been touched for more than X seconds
* **delete_file_reference_after_seconds** (positive number) During cleanup, free the memory of the files that have not been touched for more than X seconds
* **receive_access_hashes** (true/**false**) Receive chats and users access hash as updates
* **experiment_enable_file_reference_cleanup** (**true**/false) During cleanup, free the memory of the file references
* **experiment_enable_chat_access_hash_cleanup** (**true**/false) During cleanup, clean chats and channels access hash
* **enable_pull_based_backpressure** (true/**false**) Enable manual `get_channel_difference` execution by calling `getChannelDifference(channel_difference_id)`.
Don't modify this option unless you have a very large bot that struggles to keep up with start-up updates throughput, or you want to implement a pull-based async library.
## Custom API functions
### TdApi.OptimizeMemory
This method is used to optimize the memory usage, but it must be used carefully.

View File

@ -8283,11 +8283,11 @@ class ContactsManager::UserLogEvent {
};
void ContactsManager::save_user(User *u, UserId user_id, bool from_binlog) {
if (u != nullptr && G()->shared_config().get_option_boolean("receive_access_hashes", false)) {
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateAccessHash>(get_user_access_hash_object(user_id, u)));
}
if (!G()->parameters().use_chat_info_db) {
if (u != nullptr && G()->shared_config().get_option_boolean("receive_access_hashes", false)) {
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateAccessHash>(get_user_access_hash_object(user_id, u)));
}
return;
}
CHECK(u != nullptr);
@ -8825,11 +8825,11 @@ class ContactsManager::ChannelLogEvent {
};
void ContactsManager::save_channel(Channel *c, ChannelId channel_id, bool from_binlog) {
if (c != nullptr && G()->shared_config().get_option_boolean("receive_access_hashes", false)) {
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateAccessHash>(get_channel_access_hash_object(channel_id, c)));
}
if (!G()->parameters().use_chat_info_db) {
if (c != nullptr && G()->shared_config().get_option_boolean("receive_access_hashes", false)) {
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateAccessHash>(get_channel_access_hash_object(channel_id, c)));
}
return;
}
CHECK(c != nullptr);