Remove user/channel debug_source.

GitOrigin-RevId: a9d8fc3841d04e448ee6ef9a34b084d1d302257c
This commit is contained in:
levlam 2019-10-18 01:17:46 +03:00
parent 3a04f729d3
commit 9fa88eb0ec
2 changed files with 3 additions and 22 deletions

View File

@ -5368,12 +5368,7 @@ void ContactsManager::on_binlog_user_event(BinlogEvent &&event) {
auto user_id = log_event.user_id; auto user_id = log_event.user_id;
LOG(INFO) << "Add " << user_id << " from binlog"; LOG(INFO) << "Add " << user_id << " from binlog";
User *u = add_user(user_id, "on_binlog_user_event"); User *u = add_user(user_id, "on_binlog_user_event");
if (!(u->first_name.empty() && u->last_name.empty()) && Slice(u->debug_source) == Slice("on_binlog_user_event")) { LOG_CHECK(u->first_name.empty() && u->last_name.empty()) << user_id;
LOG(ERROR) << "Skip adding already added " << user_id;
binlog_erase(G()->td_db()->get_binlog(), event.id_);
return; // TODO fix bug in Binlog and remove that fix
}
LOG_CHECK(u->first_name.empty() && u->last_name.empty()) << user_id << " " << u->debug_source;
*u = std::move(log_event.u); // users come from binlog before all other events, so just add them *u = std::move(log_event.u); // users come from binlog before all other events, so just add them
u->logevent_id = event.id_; u->logevent_id = event.id_;
@ -5859,12 +5854,7 @@ void ContactsManager::on_binlog_channel_event(BinlogEvent &&event) {
auto channel_id = log_event.channel_id; auto channel_id = log_event.channel_id;
LOG(INFO) << "Add " << channel_id << " from binlog"; LOG(INFO) << "Add " << channel_id << " from binlog";
Channel *c = add_channel(channel_id, "on_binlog_channel_event"); Channel *c = add_channel(channel_id, "on_binlog_channel_event");
if (!c->status.is_banned() && Slice(c->debug_source) == Slice("on_binlog_channel_event")) { LOG_CHECK(c->status.is_banned()) << channel_id;
LOG(ERROR) << "Skip adding already added " << channel_id;
binlog_erase(G()->td_db()->get_binlog(), event.id_);
return; // TODO fix bug in Binlog and remove that fix
}
LOG_CHECK(c->status.is_banned()) << channel_id << " " << c->debug_source;
*c = std::move(log_event.c); // channels come from binlog before all other events, so just add them *c = std::move(log_event.c); // channels come from binlog before all other events, so just add them
c->logevent_id = event.id_; c->logevent_id = event.id_;
@ -8988,11 +8978,7 @@ bool ContactsManager::get_user(UserId user_id, int left_tries, Promise<Unit> &&p
ContactsManager::User *ContactsManager::add_user(UserId user_id, const char *source) { ContactsManager::User *ContactsManager::add_user(UserId user_id, const char *source) {
CHECK(user_id.is_valid()); CHECK(user_id.is_valid());
User *u = &users_[user_id]; return &users_[user_id];
if (u->debug_source == nullptr) {
u->debug_source = source;
}
return u;
} }
const ContactsManager::UserFull *ContactsManager::get_user_full(UserId user_id) const { const ContactsManager::UserFull *ContactsManager::get_user_full(UserId user_id) const {
@ -9509,7 +9495,6 @@ ContactsManager::Channel *ContactsManager::add_channel(ChannelId channel_id, con
c->photo_source_id = it->second; c->photo_source_id = it->second;
channel_photo_file_source_ids_.erase(it); channel_photo_file_source_ids_.erase(it);
} }
c->debug_source = source;
return c; return c;
} }

View File

@ -531,8 +531,6 @@ class ContactsManager : public Actor {
uint64 logevent_id = 0; uint64 logevent_id = 0;
const char *debug_source = nullptr;
template <class StorerT> template <class StorerT>
void store(StorerT &storer) const; void store(StorerT &storer) const;
@ -665,8 +663,6 @@ class ContactsManager : public Actor {
bool is_being_saved = false; // is current channel being saved to the database bool is_being_saved = false; // is current channel being saved to the database
uint64 logevent_id = 0; uint64 logevent_id = 0;
const char *debug_source = nullptr;
template <class StorerT> template <class StorerT>
void store(StorerT &storer) const; void store(StorerT &storer) const;