Skip to content

Commit

Permalink
Set inactivity timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Oct 21, 2024
1 parent 7721106 commit bdea588
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/MTProtoTools/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public function uploadFromUrl(string|FileCallbackInterface $url, int $size = 0,
}
$request = new Request($url);
$request->setTransferTimeout(INF);
$request->setInactivityTimeout(INF);
$request->setBodySizeLimit(512 * 1024 * 8000);
$response = $this->datacenter->getHTTPClient()->request($request, $cancellation);
if (($status = $response->getStatus()) !== 200) {
Expand Down
1 change: 1 addition & 0 deletions src/MTProtoTools/FilesAbstraction.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function getStream(Message|Media|LocalFile|RemoteUrl|BotApiFileId|Readabl
self::$client ??= HttpClientBuilder::buildDefault();
$request = new Request($stream->url);
$request->setTransferTimeout(INF);
$request->setInactivityTimeout(INF);
$request->setBodySizeLimit(512 * 1024 * 8000);
$response = self::$client->request(
$request,
Expand Down
1 change: 1 addition & 0 deletions src/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ public static function openBuffered(LocalFile|RemoteUrl|ReadableStream $stream,
self::$client ??= HttpClientBuilder::buildDefault();
$request = new Request($stream->url);
$request->setTransferTimeout(INF);
$request->setInactivityTimeout(INF);
$stream = self::$client->request(
$request,
$cancellation
Expand Down

0 comments on commit bdea588

Please sign in to comment.