Update dependencies, use ParallelAPIRequest
This commit is contained in:
parent
493ac3ca03
commit
161c2b3bc1
@ -4,6 +4,7 @@
|
||||
* Updated to use Kitsu API after discontinuation of Hummingbird
|
||||
* 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 character pages
|
||||
|
||||
## Version 3
|
||||
* Converted user configuration to toml files
|
||||
|
@ -21,7 +21,7 @@
|
||||
"aura/router": "^3.0",
|
||||
"aura/session": "^2.0",
|
||||
"aviat/banker": "^1.0.0",
|
||||
"aviat/ion": "dev-master",
|
||||
"aviat/ion": "^2.0.0",
|
||||
"monolog/monolog": "^1.0",
|
||||
"psr/http-message": "~1.0",
|
||||
"psr/log": "~1.0",
|
||||
|
@ -19,7 +19,12 @@ namespace Aviat\AnimeClient\API\Kitsu;
|
||||
use function Amp\{all, wait};
|
||||
|
||||
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\{
|
||||
AnimeWatchingStatus\Title,
|
||||
AnimeWatchingStatus\Kitsu as KitsuWatchingStatus,
|
||||
@ -343,18 +348,16 @@ class Model {
|
||||
$size = 100;
|
||||
$pages = ceil($count / $size);
|
||||
|
||||
$requests = [];
|
||||
$requester = new ParallelAPIRequest();
|
||||
|
||||
// Set up requests
|
||||
for ($i = 0; $i < $pages; $i++)
|
||||
{
|
||||
$offset = $i * $size;
|
||||
$requests[] = $this->getPagedAnimeList($size, $offset, $options);
|
||||
$requester->addRequest($this->getPagedAnimeList($size, $offset, $options));
|
||||
}
|
||||
|
||||
$promiseArray = (new Client())->requestMulti($requests);
|
||||
|
||||
$responses = wait(all($promiseArray));
|
||||
$responses = $requester->makeRequests();
|
||||
$output = [];
|
||||
|
||||
foreach($responses as $response)
|
||||
|
Loading…
Reference in New Issue
Block a user