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.
The output contains a string that can be parsed as a JSON.
## Other reccomended options
## Other recommended options
* Options:
* ignore_inline_thumbnails: 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

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 {
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));
return;
}
vector<string> output = {"{\"memory_stats\":{"};
vector<string> output = {"{"};
output.push_back("\"memory_stats\":{");
output.push_back("\"messages_manager_\":{");
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);
output.push_back("}");
output.push_back("}}");
output.push_back("}");
output.push_back("}");
string s;
s = accumulate(output.begin(), output.end(), s);

View File

@ -39,7 +39,7 @@ class Td;
struct MemoryStats {
string debug;
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;
};