aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2025-05-14 13:32:14 +0300
committerlevlam <levlam@telegram.org>2025-05-14 13:32:14 +0300
commitdb5284470fb7113f0fefb9b685b1852cd6f51b48 (patch)
tree5a2c42c4f86553502b5fcb89cc2f733559132301
parente55e678ff4a5ec23a542460a45e0e6b1b5cc2651 (diff)
Improve constant names.
-rw-r--r--td/telegram/DialogDb.cpp8
-rw-r--r--td/telegram/MessageContent.cpp4
-rw-r--r--td/telegram/MessageDb.cpp8
-rw-r--r--td/telegram/MessageThreadDb.cpp8
-rw-r--r--td/telegram/StoryDb.cpp8
-rw-r--r--tddb/td/db/SqliteKeyValueAsync.cpp8
6 files changed, 22 insertions, 22 deletions
diff --git a/td/telegram/DialogDb.cpp b/td/telegram/DialogDb.cpp
index 6a719e49a..626f51139 100644
--- a/td/telegram/DialogDb.cpp
+++ b/td/telegram/DialogDb.cpp
@@ -433,8 +433,8 @@ class DialogDbAsync final : public DialogDbAsyncInterface {
std::shared_ptr<DialogDbSyncSafeInterface> sync_db_safe_;
DialogDbSyncInterface *sync_db_ = nullptr;
- static constexpr size_t MAX_PENDING_QUERIES_COUNT{50};
- static constexpr double MAX_PENDING_QUERIES_DELAY{0.01};
+ static constexpr size_t MAX_PENDING_QUERY_COUNT{50};
+ static constexpr double MAX_PENDING_QUERY_DELAY{0.01};
//NB: order is important, destructor of pending_writes_ will change finished_writes_
vector<Promise<Unit>> finished_writes_;
@@ -444,11 +444,11 @@ class DialogDbAsync final : public DialogDbAsyncInterface {
template <class F>
void add_write_query(F &&f) {
pending_writes_.push_back(PromiseCreator::lambda(std::forward<F>(f)));
- if (pending_writes_.size() > MAX_PENDING_QUERIES_COUNT) {
+ if (pending_writes_.size() > MAX_PENDING_QUERY_COUNT) {
do_flush();
wakeup_at_ = 0;
} else if (wakeup_at_ == 0) {
- wakeup_at_ = Time::now_cached() + MAX_PENDING_QUERIES_DELAY;
+ wakeup_at_ = Time::now_cached() + MAX_PENDING_QUERY_DELAY;
}
if (wakeup_at_ != 0) {
set_timeout_at(wakeup_at_);
diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp
index f6979e8e6..f8ffd7af7 100644
--- a/td/telegram/MessageContent.cpp
+++ b/td/telegram/MessageContent.cpp
@@ -5483,8 +5483,8 @@ static void merge_location_access_hash(const Location &first, const Location &se
}
static bool need_message_text_changed_warning(const MessageText *old_content, const MessageText *new_content) {
- const int32 MAX_CUSTOM_ENTITIES_COUNT = 100; // server-side limit
- if (old_content->text.entities.size() > MAX_CUSTOM_ENTITIES_COUNT) {
+ const int32 MAX_CUSTOM_ENTITY_COUNT = 100; // server-side limit
+ if (old_content->text.entities.size() > MAX_CUSTOM_ENTITY_COUNT) {
return false;
}
if (new_content->text.text == "Unsupported characters" ||
diff --git a/td/telegram/MessageDb.cpp b/td/telegram/MessageDb.cpp
index dc04ca91b..cc8d71ced 100644
--- a/td/telegram/MessageDb.cpp
+++ b/td/telegram/MessageDb.cpp
@@ -1184,8 +1184,8 @@ class MessageDbAsync final : public MessageDbAsyncInterface {
std::shared_ptr<MessageDbSyncSafeInterface> sync_db_safe_;
MessageDbSyncInterface *sync_db_ = nullptr;
- static constexpr size_t MAX_PENDING_QUERIES_COUNT{50};
- static constexpr double MAX_PENDING_QUERIES_DELAY{0.01};
+ static constexpr size_t MAX_PENDING_QUERY_COUNT{50};
+ static constexpr double MAX_PENDING_QUERY_DELAY{0.01};
//NB: order is important, destructor of pending_writes_ will change finished_writes_
vector<Promise<Unit>> finished_writes_;
@@ -1195,11 +1195,11 @@ class MessageDbAsync final : public MessageDbAsyncInterface {
template <class F>
void add_write_query(F &&f) {
pending_writes_.push_back(PromiseCreator::lambda(std::forward<F>(f)));
- if (pending_writes_.size() > MAX_PENDING_QUERIES_COUNT) {
+ if (pending_writes_.size() > MAX_PENDING_QUERY_COUNT) {
do_flush();
wakeup_at_ = 0;
} else if (wakeup_at_ == 0) {
- wakeup_at_ = Time::now_cached() + MAX_PENDING_QUERIES_DELAY;
+ wakeup_at_ = Time::now_cached() + MAX_PENDING_QUERY_DELAY;
}
if (wakeup_at_ != 0) {
set_timeout_at(wakeup_at_);
diff --git a/td/telegram/MessageThreadDb.cpp b/td/telegram/MessageThreadDb.cpp
index 66a1a7ede..ddbabd570 100644
--- a/td/telegram/MessageThreadDb.cpp
+++ b/td/telegram/MessageThreadDb.cpp
@@ -287,8 +287,8 @@ class MessageThreadDbAsync final : public MessageThreadDbAsyncInterface {
std::shared_ptr<MessageThreadDbSyncSafeInterface> sync_db_safe_;
MessageThreadDbSyncInterface *sync_db_ = nullptr;
- static constexpr size_t MAX_PENDING_QUERIES_COUNT{50};
- static constexpr double MAX_PENDING_QUERIES_DELAY{0.01};
+ static constexpr size_t MAX_PENDING_QUERY_COUNT{50};
+ static constexpr double MAX_PENDING_QUERY_DELAY{0.01};
//NB: order is important, destructor of pending_writes_ will change finished_writes_
vector<Promise<Unit>> finished_writes_;
@@ -298,11 +298,11 @@ class MessageThreadDbAsync final : public MessageThreadDbAsyncInterface {
template <class F>
void add_write_query(F &&f) {
pending_writes_.push_back(PromiseCreator::lambda(std::forward<F>(f)));
- if (pending_writes_.size() > MAX_PENDING_QUERIES_COUNT) {
+ if (pending_writes_.size() > MAX_PENDING_QUERY_COUNT) {
do_flush();
wakeup_at_ = 0;
} else if (wakeup_at_ == 0) {
- wakeup_at_ = Time::now_cached() + MAX_PENDING_QUERIES_DELAY;
+ wakeup_at_ = Time::now_cached() + MAX_PENDING_QUERY_DELAY;
}
if (wakeup_at_ != 0) {
set_timeout_at(wakeup_at_);
diff --git a/td/telegram/StoryDb.cpp b/td/telegram/StoryDb.cpp
index c15c29d20..61f7a8f7c 100644
--- a/td/telegram/StoryDb.cpp
+++ b/td/telegram/StoryDb.cpp
@@ -516,8 +516,8 @@ class StoryDbAsync final : public StoryDbAsyncInterface {
std::shared_ptr<StoryDbSyncSafeInterface> sync_db_safe_;
StoryDbSyncInterface *sync_db_ = nullptr;
- static constexpr size_t MAX_PENDING_QUERIES_COUNT{50};
- static constexpr double MAX_PENDING_QUERIES_DELAY{0.01};
+ static constexpr size_t MAX_PENDING_QUERY_COUNT{50};
+ static constexpr double MAX_PENDING_QUERY_DELAY{0.01};
//NB: order is important, destructor of pending_writes_ will change finished_writes_
vector<Promise<Unit>> finished_writes_;
@@ -527,11 +527,11 @@ class StoryDbAsync final : public StoryDbAsyncInterface {
template <class F>
void add_write_query(F &&f) {
pending_writes_.push_back(PromiseCreator::lambda(std::forward<F>(f)));
- if (pending_writes_.size() > MAX_PENDING_QUERIES_COUNT) {
+ if (pending_writes_.size() > MAX_PENDING_QUERY_COUNT) {
do_flush();
wakeup_at_ = 0;
} else if (wakeup_at_ == 0) {
- wakeup_at_ = Time::now_cached() + MAX_PENDING_QUERIES_DELAY;
+ wakeup_at_ = Time::now_cached() + MAX_PENDING_QUERY_DELAY;
}
if (wakeup_at_ != 0) {
set_timeout_at(wakeup_at_);
diff --git a/tddb/td/db/SqliteKeyValueAsync.cpp b/tddb/td/db/SqliteKeyValueAsync.cpp
index 8d705d8f7..6af444e22 100644
--- a/tddb/td/db/SqliteKeyValueAsync.cpp
+++ b/tddb/td/db/SqliteKeyValueAsync.cpp
@@ -108,8 +108,8 @@ class SqliteKeyValueAsync final : public SqliteKeyValueAsyncInterface {
std::shared_ptr<SqliteKeyValueSafe> kv_safe_;
SqliteKeyValue *kv_ = nullptr;
- static constexpr double MAX_PENDING_QUERIES_DELAY = 0.01;
- static constexpr size_t MAX_PENDING_QUERIES_COUNT = 100;
+ static constexpr double MAX_PENDING_QUERY_DELAY = 0.01;
+ static constexpr size_t MAX_PENDING_QUERY_COUNT = 100;
FlatHashMap<string, optional<string>> buffer_;
vector<Promise<Unit>> buffer_promises_;
size_t cnt_ = 0;
@@ -123,9 +123,9 @@ class SqliteKeyValueAsync final : public SqliteKeyValueAsyncInterface {
if (!force) {
auto now = Time::now_cached();
if (wakeup_at_ == 0) {
- wakeup_at_ = now + MAX_PENDING_QUERIES_DELAY;
+ wakeup_at_ = now + MAX_PENDING_QUERY_DELAY;
}
- if (now < wakeup_at_ && cnt_ < MAX_PENDING_QUERIES_COUNT) {
+ if (now < wakeup_at_ && cnt_ < MAX_PENDING_QUERY_COUNT) {
set_timeout_at(wakeup_at_);
return;
}