Silence some BOT_METHOD_INVALID errors.

GitOrigin-RevId: d248a663a054029d97dd2884582d01ee4dbb68b1
This commit is contained in:
levlam 2019-02-19 21:15:08 +03:00
parent 74b37c56a2
commit 97c62b48f5
2 changed files with 11 additions and 3 deletions

View File

@ -1421,8 +1421,12 @@ void ConnectionCreator::on_result(NetQueryPtr query) {
if (G()->close_flag()) { if (G()->close_flag()) {
return; return;
} }
LOG(ERROR) << "Receive error for getProxyData: " << res.error(); if (res.error().message() == "BOT_METHOD_INVALID") {
return schedule_get_proxy_info(60); get_proxy_info_timestamp_ = Timestamp::in(30 * 86400);
} else {
LOG(ERROR) << "Receive error for getProxyData: " << res.error();
return schedule_get_proxy_info(60);
}
} }
on_get_proxy_info(res.move_as_ok()); on_get_proxy_info(res.move_as_ok());
} }

View File

@ -7,6 +7,7 @@
#include "td/telegram/net/NetQuery.h" #include "td/telegram/net/NetQuery.h"
#include "td/telegram/Global.h" #include "td/telegram/Global.h"
#include "td/telegram/telegram_api.h"
#include "td/utils/as.h" #include "td/utils/as.h"
#include "td/utils/misc.h" #include "td/utils/misc.h"
@ -52,7 +53,10 @@ void NetQuery::set_error(Status status, string source) {
LOG(ERROR) << "Receive INPUT_METHOD_INVALID for query " << format::as_hex_dump<4>(Slice(query_.as_slice())); LOG(ERROR) << "Receive INPUT_METHOD_INVALID for query " << format::as_hex_dump<4>(Slice(query_.as_slice()));
} }
if (status.message() == "BOT_METHOD_INVALID") { if (status.message() == "BOT_METHOD_INVALID") {
LOG(ERROR) << "Receive BOT_METHOD_INVALID for query " << format::as_hex(tl_constructor()); auto id = tl_constructor();
if (id != telegram_api::help_getNearestDc::ID && id != telegram_api::help_getProxyData::ID) {
LOG(ERROR) << "Receive BOT_METHOD_INVALID for query " << format::as_hex(id);
}
} }
if (status.message() == "MSG_WAIT_FAILED" && status.code() != 400) { if (status.message() == "MSG_WAIT_FAILED" && status.code() != 400) {
status = Status::Error(400, "MSG_WAIT_FAILED"); status = Status::Error(400, "MSG_WAIT_FAILED");