Add experiment_enable_chat_access_hash_cleanup
This commit is contained in:
parent
53ed453f0b
commit
2f28ed3bba
@ -30,6 +30,7 @@ We added some options:
|
|||||||
* **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
|
* **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
|
||||||
* **experiment_enable_file_reference_cleanup** (true/false) During cleanup, free the memory of the file references (Experimental!)
|
* **experiment_enable_file_reference_cleanup** (true/false) During cleanup, free the memory of the file references (Experimental!)
|
||||||
* **experiment_debug_file_reference_cleanup** (true/false) During cleanup, print log messages about file references cleanup (Experimental!)
|
* **experiment_debug_file_reference_cleanup** (true/false) During cleanup, print log messages about file references cleanup (Experimental!)
|
||||||
|
* **experiment_enable_chat_access_hash_cleanup** (true/false) During cleanup, clean chats and channels access hash (Experimental!)
|
||||||
|
|
||||||
## Custom API functions
|
## Custom API functions
|
||||||
### TdApi.OptimizeMemory
|
### TdApi.OptimizeMemory
|
||||||
|
@ -14685,6 +14685,7 @@ void ContactsManager::memory_cleanup() {
|
|||||||
|
|
||||||
auto user_ttl = !G()->shared_config().get_option_integer("delete_user_reference_after_seconds", 3600);
|
auto user_ttl = !G()->shared_config().get_option_integer("delete_user_reference_after_seconds", 3600);
|
||||||
auto chat_ttl = !G()->shared_config().get_option_integer("delete_chat_reference_after_seconds", 3600);
|
auto chat_ttl = !G()->shared_config().get_option_integer("delete_chat_reference_after_seconds", 3600);
|
||||||
|
auto chat_access_hash_cleanup = !G()->shared_config().get_option_boolean("experiment_enable_chat_access_hash_cleanup", false);
|
||||||
|
|
||||||
/* DESTROY INVALID USERS */
|
/* DESTROY INVALID USERS */
|
||||||
{
|
{
|
||||||
@ -14719,6 +14720,7 @@ void ContactsManager::memory_cleanup() {
|
|||||||
my_photo_file_id_.clear();
|
my_photo_file_id_.clear();
|
||||||
my_photo_file_id_.rehash(0);
|
my_photo_file_id_.rehash(0);
|
||||||
|
|
||||||
|
if (chat_access_hash_cleanup) {
|
||||||
/* DESTROY INVALID CHATS */
|
/* DESTROY INVALID CHATS */
|
||||||
{
|
{
|
||||||
auto it = chats_.begin();
|
auto it = chats_.begin();
|
||||||
@ -14738,10 +14740,12 @@ void ContactsManager::memory_cleanup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
chats_.rehash(0);
|
chats_.rehash(0);
|
||||||
|
}
|
||||||
chats_full_.clear();
|
chats_full_.clear();
|
||||||
chats_full_.rehash(0);
|
chats_full_.rehash(0);
|
||||||
unknown_chats_.clear();
|
unknown_chats_.clear();
|
||||||
unknown_chats_.rehash(0);
|
unknown_chats_.rehash(0);
|
||||||
|
if (chat_access_hash_cleanup) {
|
||||||
chat_full_file_source_ids_.clear();
|
chat_full_file_source_ids_.clear();
|
||||||
chat_full_file_source_ids_.rehash(0);
|
chat_full_file_source_ids_.rehash(0);
|
||||||
min_channels_.clear();
|
min_channels_.clear();
|
||||||
@ -14768,10 +14772,13 @@ void ContactsManager::memory_cleanup() {
|
|||||||
channels_.rehash(0);
|
channels_.rehash(0);
|
||||||
channels_full_.clear();
|
channels_full_.clear();
|
||||||
channels_full_.rehash(0);
|
channels_full_.rehash(0);
|
||||||
|
}
|
||||||
unknown_channels_.clear();
|
unknown_channels_.clear();
|
||||||
unknown_channels_.rehash(0);
|
unknown_channels_.rehash(0);
|
||||||
|
if (chat_access_hash_cleanup) {
|
||||||
channel_full_file_source_ids_.clear();
|
channel_full_file_source_ids_.clear();
|
||||||
channel_full_file_source_ids_.rehash(0);
|
channel_full_file_source_ids_.rehash(0);
|
||||||
|
}
|
||||||
//secret_chats_.clear();
|
//secret_chats_.clear();
|
||||||
//secret_chats_.rehash(0);
|
//secret_chats_.rehash(0);
|
||||||
//unknown_secret_chats_.clear();
|
//unknown_secret_chats_.clear();
|
||||||
|
@ -7345,6 +7345,9 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
|
|||||||
if (set_boolean_option("experiment_debug_file_reference_cleanup")) {
|
if (set_boolean_option("experiment_debug_file_reference_cleanup")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (set_boolean_option("experiment_enable_chat_access_hash_cleanup")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
if (set_boolean_option("ignore_background_updates")) {
|
if (set_boolean_option("ignore_background_updates")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user