Fix floodWait management

This commit is contained in:
Daniil Gentili 2020-10-18 18:21:04 +02:00
parent 73384f0bb4
commit a9bf26c9c0
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -383,7 +383,10 @@ trait ResponseHandler
$limit = $request->getFloodWaitLimit() ?? $this->API->settings->getRPC()->getFloodTimeout(); $limit = $request->getFloodWaitLimit() ?? $this->API->settings->getRPC()->getFloodTimeout();
if (\is_numeric($seconds) && $seconds < $limit) { if (\is_numeric($seconds) && $seconds < $limit) {
$this->logger->logger("Flood, waiting $seconds seconds before repeating async call of $request...", Logger::NOTICE); $this->logger->logger("Flood, waiting $seconds seconds before repeating async call of $request...", Logger::NOTICE);
$this->gotResponseForOutgoingMessage($request);
$request->setSent(($request->getSent() ?? \time()) + $seconds); $request->setSent(($request->getSent() ?? \time()) + $seconds);
$request->setMsgId(null);
$request->setSeqNo(null);
Loop::delay($seconds * 1000, [$this, 'methodRecall'], ['message_id' => $request->getMsgId()]); Loop::delay($seconds * 1000, [$this, 'methodRecall'], ['message_id' => $request->getMsgId()]);
return null; return null;
} }