mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-23 05:51:14 +01:00
Fixup
This commit is contained in:
parent
d69ecf91d0
commit
744fa46820
@ -34,6 +34,7 @@ use danog\MadelineProto\Tools;
|
||||
use Error;
|
||||
use Revolt\EventLoop;
|
||||
|
||||
use function Amp\delay;
|
||||
use function substr;
|
||||
|
||||
/**
|
||||
@ -104,7 +105,7 @@ final class ReadLoop extends Loop
|
||||
$this->connection->reconnect();
|
||||
} elseif ($error === -429) {
|
||||
$this->API->logger("Got -429 from DC {$this->datacenter}", Logger::WARNING);
|
||||
Tools::sleep(3);
|
||||
delay(3);
|
||||
$this->connection->reconnect();
|
||||
} else {
|
||||
$this->connection->reconnect();
|
||||
|
@ -58,6 +58,7 @@ use Webmozart\Assert\Assert;
|
||||
|
||||
use const LOCK_EX;
|
||||
use function Amp\async;
|
||||
use function Amp\delay;
|
||||
use function Amp\File\deleteFile;
|
||||
use function Amp\File\getSize;
|
||||
use function Amp\File\openFile;
|
||||
@ -1171,8 +1172,7 @@ trait Files
|
||||
} else {
|
||||
$basic_param = ['file_token' => $messageMedia['file_token'], 'floodWaitLimit' => 0, 'cancellation' => $cancellation];
|
||||
}
|
||||
//$x = 0;
|
||||
while (true) {
|
||||
do {
|
||||
$cancellation?->throwIfRequested();
|
||||
try {
|
||||
$res = $this->methodCallAsyncRead(
|
||||
@ -1184,18 +1184,18 @@ trait Files
|
||||
} catch (FileRedirect $e) {
|
||||
$datacenter = $e->dc;
|
||||
} catch (FloodWaitError $e) {
|
||||
Tools::sleep(1);
|
||||
continue;
|
||||
delay(1, cancellation: $cancellation);
|
||||
} catch (RPCErrorException $e) {
|
||||
switch ($e->rpc) {
|
||||
case 'FILE_TOKEN_INVALID':
|
||||
$cdn = false;
|
||||
$datacenter = $this->authorized_dc;
|
||||
continue 3;
|
||||
default:
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
$cancellation?->throwIfRequested();
|
||||
|
||||
if ($res['_'] === 'upload.fileCdnRedirect') {
|
||||
@ -1222,6 +1222,7 @@ trait Files
|
||||
case 'FILE_TOKEN_INVALID':
|
||||
case 'REQUEST_TOKEN_INVALID':
|
||||
$cdn = false;
|
||||
$datacenter = $this->authorized_dc;
|
||||
continue 2;
|
||||
default:
|
||||
throw $e;
|
||||
|
Loading…
x
Reference in New Issue
Block a user