Print warning

This commit is contained in:
Andrea Cavalli 2021-08-24 17:34:15 +02:00
parent bfb4f8f7b2
commit 268fd8c4a9
3 changed files with 10 additions and 6 deletions

View File

@ -55,7 +55,7 @@ If you want to avoid receiving data with missing fields during cleanup:
This method is used to read the size of all the biggest data maps inside tdlib implementation. This method is used to read the size of all the biggest data maps inside tdlib implementation.
The output contains a string that can be parsed as a JSON. The output contains a string that can be parsed as a JSON.
## Other reccomended options ## Other recommended options
* Options: * Options:
* ignore_inline_thumbnails: true * ignore_inline_thumbnails: true
* disable_top_chats: true * disable_top_chats: true
@ -69,7 +69,7 @@ The output contains a string that can be parsed as a JSON.
----- -----
The following text is the classic tdlib readme: The following text is the classic TDLib readme:
# TDLib # TDLib

View File

@ -103,13 +103,15 @@ bool MemoryManager::do_session_settings_allow_for_memory_management() {
void MemoryManager::get_memory_stats(bool full, Promise<MemoryStats> promise) const { void MemoryManager::get_memory_stats(bool full, Promise<MemoryStats> promise) const {
if (!can_manage_memory()) { if (!can_manage_memory()) {
auto value = MemoryStats("{}"); auto value = MemoryStats(R"({"warning": "OptimizeMemory is not enabled, please read the recommended options on README.md"})");
promise.set_value(std::move(value)); promise.set_value(std::move(value));
return; return;
} }
vector<string> output = {"{\"memory_stats\":{"}; vector<string> output = {"{"};
output.push_back("\"memory_stats\":{");
output.push_back("\"messages_manager_\":{"); output.push_back("\"messages_manager_\":{");
td_->messages_manager_->memory_stats(output); td_->messages_manager_->memory_stats(output);
@ -200,7 +202,9 @@ void MemoryManager::get_memory_stats(bool full, Promise<MemoryStats> promise) co
td_->poll_manager_->memory_stats(output); td_->poll_manager_->memory_stats(output);
output.push_back("}"); output.push_back("}");
output.push_back("}}"); output.push_back("}");
output.push_back("}");
string s; string s;
s = accumulate(output.begin(), output.end(), s); s = accumulate(output.begin(), output.end(), s);

View File

@ -39,7 +39,7 @@ class Td;
struct MemoryStats { struct MemoryStats {
string debug; string debug;
MemoryStats() = default; MemoryStats() = default;
explicit MemoryStats(string debug) : debug(debug) { explicit MemoryStats(string debug) : debug(std::move(debug)) {
} }
tl_object_ptr<td_api::memoryStatistics> get_memory_statistics_object() const; tl_object_ptr<td_api::memoryStatistics> get_memory_statistics_object() const;
}; };