Support WORKER_BUSY_TOO_LONG_RETRY error.

GitOrigin-RevId: 44e4d36d91a44e21f679eaefac90c436a35079f2
This commit is contained in:
levlam 2018-12-26 21:01:46 +03:00
parent 2e113b1747
commit d9d45ef303

View File

@ -23,8 +23,13 @@ void NetQueryDelayer::delay(NetQueryPtr query) {
CHECK(query->is_error());
auto code = query->error().code();
double timeout = 0;
if (code < 0 || code == 500) {
if (code < 0) {
// skip
} else if (code == 500) {
auto msg = query->error().message();
if (msg == "WORKER_BUSY_TOO_LONG_RETRY") {
timeout = 1; // it is dangerous to resend query without timeout, so use 1
}
} else if (code == 420) {
auto msg = query->error().message();
for (auto prefix : {Slice("FLOOD_WAIT_"), Slice("2FA_CONFIRM_WAIT_"), Slice("TAKEOUT_INIT_DELAY_")}) {