Update dependencies, use ParallelAPIRequest
This commit is contained in:
parent
b8b5beeae1
commit
394c1241fb
@ -4,6 +4,7 @@
|
|||||||
* Updated to use Kitsu API after discontinuation of Hummingbird
|
* Updated to use Kitsu API after discontinuation of Hummingbird
|
||||||
* Added streaming links to list entries from the Kitsu API
|
* Added streaming links to list entries from the Kitsu API
|
||||||
* Added simple integration with MyAnimeList, so an update can cross-post to both Kitsu and MyAnimeList
|
* Added simple integration with MyAnimeList, so an update can cross-post to both Kitsu and MyAnimeList
|
||||||
|
* Added character pages
|
||||||
|
|
||||||
## Version 3
|
## Version 3
|
||||||
* Converted user configuration to toml files
|
* Converted user configuration to toml files
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"aura/router": "^3.0",
|
"aura/router": "^3.0",
|
||||||
"aura/session": "^2.0",
|
"aura/session": "^2.0",
|
||||||
"aviat/banker": "^1.0.0",
|
"aviat/banker": "^1.0.0",
|
||||||
"aviat/ion": "dev-master",
|
"aviat/ion": "^2.0.0",
|
||||||
"monolog/monolog": "^1.0",
|
"monolog/monolog": "^1.0",
|
||||||
"psr/http-message": "~1.0",
|
"psr/http-message": "~1.0",
|
||||||
"psr/log": "~1.0",
|
"psr/log": "~1.0",
|
||||||
|
@ -19,7 +19,12 @@ namespace Aviat\AnimeClient\API\Kitsu;
|
|||||||
use function Amp\{all, wait};
|
use function Amp\{all, wait};
|
||||||
|
|
||||||
use Amp\Artax\{Client, Request};
|
use Amp\Artax\{Client, Request};
|
||||||
use Aviat\AnimeClient\API\{CacheTrait, JsonAPI, Kitsu as K};
|
use Aviat\AnimeClient\API\{
|
||||||
|
CacheTrait,
|
||||||
|
JsonAPI,
|
||||||
|
Kitsu as K,
|
||||||
|
ParallelAPIRequest
|
||||||
|
};
|
||||||
use Aviat\AnimeClient\API\Enum\{
|
use Aviat\AnimeClient\API\Enum\{
|
||||||
AnimeWatchingStatus\Title,
|
AnimeWatchingStatus\Title,
|
||||||
AnimeWatchingStatus\Kitsu as KitsuWatchingStatus,
|
AnimeWatchingStatus\Kitsu as KitsuWatchingStatus,
|
||||||
@ -343,18 +348,16 @@ class Model {
|
|||||||
$size = 100;
|
$size = 100;
|
||||||
$pages = ceil($count / $size);
|
$pages = ceil($count / $size);
|
||||||
|
|
||||||
$requests = [];
|
$requester = new ParallelAPIRequest();
|
||||||
|
|
||||||
// Set up requests
|
// Set up requests
|
||||||
for ($i = 0; $i < $pages; $i++)
|
for ($i = 0; $i < $pages; $i++)
|
||||||
{
|
{
|
||||||
$offset = $i * $size;
|
$offset = $i * $size;
|
||||||
$requests[] = $this->getPagedAnimeList($size, $offset, $options);
|
$requester->addRequest($this->getPagedAnimeList($size, $offset, $options));
|
||||||
}
|
}
|
||||||
|
|
||||||
$promiseArray = (new Client())->requestMulti($requests);
|
$responses = $requester->makeRequests();
|
||||||
|
|
||||||
$responses = wait(all($promiseArray));
|
|
||||||
$output = [];
|
$output = [];
|
||||||
|
|
||||||
foreach($responses as $response)
|
foreach($responses as $response)
|
||||||
|
Loading…
Reference in New Issue
Block a user