Handle small SLOWMODE_WAIT as FLOOD_WAIT.
This commit is contained in:
parent
dba3c39726
commit
0cb32181c5
|
@ -1266,12 +1266,12 @@ bool Instance::Private::onErrorDefault(
|
||||||
int breakpoint = 0;
|
int breakpoint = 0;
|
||||||
}
|
}
|
||||||
auto badGuestDc = (code == 400) && (type == qsl("FILE_ID_INVALID"));
|
auto badGuestDc = (code == 400) && (type == qsl("FILE_ID_INVALID"));
|
||||||
QRegularExpressionMatch m;
|
QRegularExpressionMatch m1, m2;
|
||||||
if ((m = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(type)).hasMatch()) {
|
if ((m1 = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(type)).hasMatch()) {
|
||||||
if (!requestId) return false;
|
if (!requestId) return false;
|
||||||
|
|
||||||
auto dcWithShift = ShiftedDcId(0);
|
auto dcWithShift = ShiftedDcId(0);
|
||||||
auto newdcWithShift = ShiftedDcId(m.captured(2).toInt());
|
auto newdcWithShift = ShiftedDcId(m1.captured(2).toInt());
|
||||||
if (const auto shiftedDcId = queryRequestByDc(requestId)) {
|
if (const auto shiftedDcId = queryRequestByDc(requestId)) {
|
||||||
dcWithShift = *shiftedDcId;
|
dcWithShift = *shiftedDcId;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1329,7 +1329,11 @@ bool Instance::Private::onErrorDefault(
|
||||||
(dcWithShift < 0) ? -newdcWithShift : newdcWithShift);
|
(dcWithShift < 0) ? -newdcWithShift : newdcWithShift);
|
||||||
session->sendPrepared(request);
|
session->sendPrepared(request);
|
||||||
return true;
|
return true;
|
||||||
} else if (code < 0 || code >= 500 || (m = QRegularExpression("^FLOOD_WAIT_(\\d+)$").match(type)).hasMatch()) {
|
} else if (code < 0
|
||||||
|
|| code >= 500
|
||||||
|
|| (m1 = QRegularExpression("^FLOOD_WAIT_(\\d+)$").match(type)).hasMatch()
|
||||||
|
|| ((m2 = QRegularExpression("^SLOWMODE_WAIT_(\\d+)$").match(type)).hasMatch()
|
||||||
|
&& m2.captured(1).toInt() < 3)) {
|
||||||
if (!requestId) return false;
|
if (!requestId) return false;
|
||||||
|
|
||||||
int32 secs = 1;
|
int32 secs = 1;
|
||||||
|
@ -1340,9 +1344,11 @@ bool Instance::Private::onErrorDefault(
|
||||||
} else {
|
} else {
|
||||||
_requestsDelays.emplace(requestId, secs);
|
_requestsDelays.emplace(requestId, secs);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (m1.hasMatch()) {
|
||||||
secs = m.captured(1).toInt();
|
secs = m1.captured(1).toInt();
|
||||||
// if (secs >= 60) return false;
|
// if (secs >= 60) return false;
|
||||||
|
} else if (m2.hasMatch()) {
|
||||||
|
secs = m2.captured(1).toInt();
|
||||||
}
|
}
|
||||||
auto sendAt = crl::now() + secs * 1000 + 10;
|
auto sendAt = crl::now() + secs * 1000 + 10;
|
||||||
auto it = _delayedRequests.begin(), e = _delayedRequests.end();
|
auto it = _delayedRequests.begin(), e = _delayedRequests.end();
|
||||||
|
|
Loading…
Reference in New Issue