Add temporary ignoring of duplicate user/channel log events.
GitOrigin-RevId: ecd17421d9f2c3591ce4a4d84970949954f8496e
This commit is contained in:
parent
986652a1ae
commit
c01dcf9a99
@ -5177,7 +5177,12 @@ 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");
|
||||||
CHECK(u->first_name.empty()) << user_id << " " << u->debug_source;
|
if (!(u->first_name.empty() && u->last_name.empty()) && Slice(u->debug_source) == Slice("on_binlog_user_event")) {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
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_;
|
||||||
@ -5649,6 +5654,11 @@ 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(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
|
||||||
|
}
|
||||||
CHECK(c->status.is_banned()) << channel_id << " " << c->debug_source;
|
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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user