Unload at most 5000 messages at a time.
This commit is contained in:
parent
e8b8f3eb88
commit
f670d646c9
@ -11665,6 +11665,10 @@ void MessagesManager::find_unloadable_messages(const Dialog *d, int32 unload_bef
|
|||||||
if (m == nullptr) {
|
if (m == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (message_ids.size() >= MAX_UNLOADED_MESSAGES) {
|
||||||
|
has_left_to_unload_messages = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
find_unloadable_messages(d, unload_before_date, m->left.get(), message_ids, has_left_to_unload_messages);
|
find_unloadable_messages(d, unload_before_date, m->left.get(), message_ids, has_left_to_unload_messages);
|
||||||
|
|
||||||
@ -11980,7 +11984,9 @@ void MessagesManager::unload_dialog(DialogId dialog_id) {
|
|||||||
|
|
||||||
if (has_left_to_unload_messages) {
|
if (has_left_to_unload_messages) {
|
||||||
LOG(DEBUG) << "Need to unload more messages in " << dialog_id;
|
LOG(DEBUG) << "Need to unload more messages in " << dialog_id;
|
||||||
pending_unload_dialog_timeout_.add_timeout_in(d->dialog_id.get(), get_next_unload_dialog_delay(d));
|
pending_unload_dialog_timeout_.add_timeout_in(
|
||||||
|
d->dialog_id.get(),
|
||||||
|
to_unload_message_ids.size() >= MAX_UNLOADED_MESSAGES ? 1.0 : get_next_unload_dialog_delay(d));
|
||||||
} else {
|
} else {
|
||||||
d->has_unload_timeout = false;
|
d->has_unload_timeout = false;
|
||||||
}
|
}
|
||||||
|
@ -1810,7 +1810,8 @@ class MessagesManager final : public Actor {
|
|||||||
static constexpr size_t MAX_DIALOG_FILTER_TITLE_LENGTH = 12; // server side limit for dialog filter title
|
static constexpr size_t MAX_DIALOG_FILTER_TITLE_LENGTH = 12; // server side limit for dialog filter title
|
||||||
static constexpr int32 MAX_PRIVATE_MESSAGE_TTL = 60; // server side limit
|
static constexpr int32 MAX_PRIVATE_MESSAGE_TTL = 60; // server side limit
|
||||||
static constexpr int32 DIALOG_FILTERS_CACHE_TIME = 86400;
|
static constexpr int32 DIALOG_FILTERS_CACHE_TIME = 86400;
|
||||||
static constexpr size_t MIN_DELETED_ASYNCHRONOUSLY_MESSAGES = 10u;
|
static constexpr size_t MIN_DELETED_ASYNCHRONOUSLY_MESSAGES = 10;
|
||||||
|
static constexpr size_t MAX_UNLOADED_MESSAGES = 5000;
|
||||||
|
|
||||||
static constexpr int64 SPONSORED_DIALOG_ORDER = static_cast<int64>(2147483647) << 32;
|
static constexpr int64 SPONSORED_DIALOG_ORDER = static_cast<int64>(2147483647) << 32;
|
||||||
static constexpr int32 MIN_PINNED_DIALOG_DATE = 2147000000; // some big date
|
static constexpr int32 MIN_PINNED_DIALOG_DATE = 2147000000; // some big date
|
||||||
|
Loading…
Reference in New Issue
Block a user