Minor fixes.
This commit is contained in:
parent
0455f8cfbb
commit
b1ddf9d3a7
@ -38,6 +38,7 @@
|
|||||||
#include "td/telegram/PasswordManager.h"
|
#include "td/telegram/PasswordManager.h"
|
||||||
#include "td/telegram/Photo.h"
|
#include "td/telegram/Photo.h"
|
||||||
#include "td/telegram/Photo.hpp"
|
#include "td/telegram/Photo.hpp"
|
||||||
|
#include "td/telegram/PhotoSize.h"
|
||||||
#include "td/telegram/PremiumGiftOption.hpp"
|
#include "td/telegram/PremiumGiftOption.hpp"
|
||||||
#include "td/telegram/SecretChatLayer.h"
|
#include "td/telegram/SecretChatLayer.h"
|
||||||
#include "td/telegram/SecretChatsManager.h"
|
#include "td/telegram/SecretChatsManager.h"
|
||||||
|
@ -476,15 +476,9 @@ class DialogDbAsync final : public DialogDbAsyncInterface {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sync_db_->begin_write_transaction().ensure();
|
sync_db_->begin_write_transaction().ensure();
|
||||||
for (auto &query : pending_writes_) {
|
set_promises(pending_writes_);
|
||||||
query.set_value(Unit());
|
|
||||||
}
|
|
||||||
sync_db_->commit_transaction().ensure();
|
sync_db_->commit_transaction().ensure();
|
||||||
pending_writes_.clear();
|
set_promises(finished_writes_);
|
||||||
for (auto &promise : finished_writes_) {
|
|
||||||
promise.set_value(Unit());
|
|
||||||
}
|
|
||||||
finished_writes_.clear();
|
|
||||||
cancel_timeout();
|
cancel_timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1236,15 +1236,9 @@ class MessageDbAsync final : public MessageDbAsyncInterface {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sync_db_->begin_write_transaction().ensure();
|
sync_db_->begin_write_transaction().ensure();
|
||||||
for (auto &query : pending_writes_) {
|
set_promises(pending_writes_);
|
||||||
query.set_value(Unit());
|
|
||||||
}
|
|
||||||
sync_db_->commit_transaction().ensure();
|
sync_db_->commit_transaction().ensure();
|
||||||
pending_writes_.clear();
|
set_promises(finished_writes_);
|
||||||
for (auto &promise : finished_writes_) {
|
|
||||||
promise.set_value(Unit());
|
|
||||||
}
|
|
||||||
finished_writes_.clear();
|
|
||||||
cancel_timeout();
|
cancel_timeout();
|
||||||
}
|
}
|
||||||
void timeout_expired() final {
|
void timeout_expired() final {
|
||||||
|
@ -10,15 +10,16 @@
|
|||||||
|
|
||||||
#include "td/db/SqliteConnectionSafe.h"
|
#include "td/db/SqliteConnectionSafe.h"
|
||||||
#include "td/db/SqliteDb.h"
|
#include "td/db/SqliteDb.h"
|
||||||
#include "td/db/SqliteKeyValue.h"
|
|
||||||
#include "td/db/SqliteStatement.h"
|
#include "td/db/SqliteStatement.h"
|
||||||
|
|
||||||
#include "td/actor/actor.h"
|
#include "td/actor/actor.h"
|
||||||
#include "td/actor/SchedulerLocalStorage.h"
|
#include "td/actor/SchedulerLocalStorage.h"
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
|
#include "td/utils/format.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
#include "td/utils/ScopeGuard.h"
|
#include "td/utils/ScopeGuard.h"
|
||||||
|
#include "td/utils/Time.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
// NB: must happen inside a transaction
|
// NB: must happen inside a transaction
|
||||||
@ -317,15 +318,9 @@ class MessageThreadDbAsync final : public MessageThreadDbAsyncInterface {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sync_db_->begin_write_transaction().ensure();
|
sync_db_->begin_write_transaction().ensure();
|
||||||
for (auto &query : pending_writes_) {
|
set_promises(pending_writes_);
|
||||||
query.set_value(Unit());
|
|
||||||
}
|
|
||||||
sync_db_->commit_transaction().ensure();
|
sync_db_->commit_transaction().ensure();
|
||||||
pending_writes_.clear();
|
set_promises(finished_writes_);
|
||||||
for (auto &promise : finished_writes_) {
|
|
||||||
promise.set_value(Unit());
|
|
||||||
}
|
|
||||||
finished_writes_.clear();
|
|
||||||
cancel_timeout();
|
cancel_timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +479,7 @@ Promise<> UpdatesManager::set_pts(int32 pts, const char *source) {
|
|||||||
Promise<> result;
|
Promise<> result;
|
||||||
if (pts > get_pts() || (0 < pts && pts < get_pts() - 399999)) { // pts can only go up or drop cardinally
|
if (pts > get_pts() || (0 < pts && pts < get_pts() - 399999)) { // pts can only go up or drop cardinally
|
||||||
if (pts < get_pts() - 399999) {
|
if (pts < get_pts() - 399999) {
|
||||||
LOG(WARNING) << "Pts decreases from " << get_pts() << " to " << pts << " from " << source;
|
LOG(WARNING) << "PTS decreases from " << get_pts() << " to " << pts << " from " << source;
|
||||||
} else {
|
} else {
|
||||||
LOG(INFO) << "Update pts from " << get_pts() << " to " << pts << " from " << source;
|
LOG(INFO) << "Update pts from " << get_pts() << " to " << pts << " from " << source;
|
||||||
}
|
}
|
||||||
@ -2606,14 +2606,14 @@ void UpdatesManager::process_postponed_pts_updates() {
|
|||||||
}
|
}
|
||||||
CHECK(!running_get_difference_);
|
CHECK(!running_get_difference_);
|
||||||
if (skipped_update_count + applied_update_count > 0) {
|
if (skipped_update_count + applied_update_count > 0) {
|
||||||
VLOG(get_difference) << "Pts has changed from " << initial_pts << " to " << old_pts << " after skipping "
|
VLOG(get_difference) << "PTS has changed from " << initial_pts << " to " << old_pts << " after skipping "
|
||||||
<< skipped_update_count << ", applying " << applied_update_count << " and keeping "
|
<< skipped_update_count << ", applying " << applied_update_count << " and keeping "
|
||||||
<< postponed_pts_updates_.size() << " postponed updates";
|
<< postponed_pts_updates_.size() << " postponed updates";
|
||||||
}
|
}
|
||||||
|
|
||||||
auto passed_time = Time::now() - begin_time;
|
auto passed_time = Time::now() - begin_time;
|
||||||
if (passed_time >= UPDATE_APPLY_WARNING_TIME) {
|
if (passed_time >= UPDATE_APPLY_WARNING_TIME) {
|
||||||
LOG(WARNING) << "Pts has changed from " << initial_pts << " to " << old_pts << " after skipping "
|
LOG(WARNING) << "PTS has changed from " << initial_pts << " to " << old_pts << " after skipping "
|
||||||
<< skipped_update_count << ", applying " << applied_update_count << " and keeping "
|
<< skipped_update_count << ", applying " << applied_update_count << " and keeping "
|
||||||
<< postponed_pts_updates_.size() << " postponed for " << (Time::now() - get_difference_start_time_)
|
<< postponed_pts_updates_.size() << " postponed for " << (Time::now() - get_difference_start_time_)
|
||||||
<< " updates in " << passed_time;
|
<< " updates in " << passed_time;
|
||||||
@ -2669,7 +2669,7 @@ void UpdatesManager::process_pending_pts_updates() {
|
|||||||
|
|
||||||
auto passed_time = Time::now() - begin_time;
|
auto passed_time = Time::now() - begin_time;
|
||||||
if (passed_time >= UPDATE_APPLY_WARNING_TIME) {
|
if (passed_time >= UPDATE_APPLY_WARNING_TIME) {
|
||||||
LOG(WARNING) << "Pts has changed from " << initial_pts << " to " << get_pts() << " after applying "
|
LOG(WARNING) << "PTS has changed from " << initial_pts << " to " << get_pts() << " after applying "
|
||||||
<< applied_update_count << " and keeping " << pending_pts_updates_.size() << " pending updates in "
|
<< applied_update_count << " and keeping " << pending_pts_updates_.size() << " pending updates in "
|
||||||
<< passed_time;
|
<< passed_time;
|
||||||
}
|
}
|
||||||
@ -2682,7 +2682,7 @@ void UpdatesManager::process_pending_seq_updates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto begin_time = Time::now();
|
auto begin_time = Time::now();
|
||||||
int32 iniital_seq = seq_;
|
int32 initial_seq = seq_;
|
||||||
int32 applied_update_count = 0;
|
int32 applied_update_count = 0;
|
||||||
while (!pending_seq_updates_.empty() && !running_get_difference_) {
|
while (!pending_seq_updates_.empty() && !running_get_difference_) {
|
||||||
auto update_it = pending_seq_updates_.begin();
|
auto update_it = pending_seq_updates_.begin();
|
||||||
@ -2726,7 +2726,7 @@ void UpdatesManager::process_pending_seq_updates() {
|
|||||||
|
|
||||||
auto passed_time = Time::now() - begin_time;
|
auto passed_time = Time::now() - begin_time;
|
||||||
if (passed_time >= UPDATE_APPLY_WARNING_TIME) {
|
if (passed_time >= UPDATE_APPLY_WARNING_TIME) {
|
||||||
LOG(WARNING) << "Seq has changed from " << iniital_seq << " to " << seq_ << " after applying "
|
LOG(WARNING) << "Seq has changed from " << initial_seq << " to " << seq_ << " after applying "
|
||||||
<< applied_update_count << " and keeping " << pending_seq_updates_.size() << " pending updates in "
|
<< applied_update_count << " and keeping " << pending_seq_updates_.size() << " pending updates in "
|
||||||
<< passed_time;
|
<< passed_time;
|
||||||
}
|
}
|
||||||
@ -2780,7 +2780,7 @@ void UpdatesManager::process_pending_qts_updates() {
|
|||||||
|
|
||||||
auto passed_time = Time::now() - begin_time;
|
auto passed_time = Time::now() - begin_time;
|
||||||
if (passed_time >= UPDATE_APPLY_WARNING_TIME) {
|
if (passed_time >= UPDATE_APPLY_WARNING_TIME) {
|
||||||
LOG(WARNING) << "Qts has changed from " << initial_qts << " to " << get_qts() << " after applying "
|
LOG(WARNING) << "QTS has changed from " << initial_qts << " to " << get_qts() << " after applying "
|
||||||
<< applied_update_count << " and keeping " << pending_qts_updates_.size() << " pending updates in "
|
<< applied_update_count << " and keeping " << pending_qts_updates_.size() << " pending updates in "
|
||||||
<< passed_time;
|
<< passed_time;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "td/telegram/telegram_api.h"
|
#include "td/telegram/telegram_api.h"
|
||||||
#include "td/telegram/UpdatesManager.h"
|
#include "td/telegram/UpdatesManager.h"
|
||||||
|
|
||||||
|
#include "td/utils/buffer.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "td/db/binlog/BinlogInterface.h"
|
#include "td/db/binlog/BinlogInterface.h"
|
||||||
|
|
||||||
#include "td/utils/FlatHashMap.h"
|
#include "td/utils/FlatHashMap.h"
|
||||||
|
#include "td/utils/logging.h"
|
||||||
#include "td/utils/misc.h"
|
#include "td/utils/misc.h"
|
||||||
#include "td/utils/Random.h"
|
#include "td/utils/Random.h"
|
||||||
#include "td/utils/StorerBase.h"
|
#include "td/utils/StorerBase.h"
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
#include "td/net/SslStream.h"
|
#include "td/net/SslCtx.h"
|
||||||
|
|
||||||
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/crypto.h"
|
#include "td/utils/crypto.h"
|
||||||
#include "td/utils/FlatHashMap.h"
|
#include "td/utils/FlatHashMap.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class FloodControlFast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void add_limit(double duration, double count) {
|
void add_limit(double duration, double count) {
|
||||||
buckets_.emplace_back(FloodControlBucket(duration, count));
|
buckets_.emplace_back(duration, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_events() {
|
void clear_events() {
|
||||||
|
Loading…
Reference in New Issue
Block a user