Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronous requests with v5.0 #6

Open
chypriote opened this issue May 24, 2022 · 0 comments
Open

Asynchronous requests with v5.0 #6

chypriote opened this issue May 24, 2022 · 0 comments

Comments

@chypriote
Copy link

chypriote commented May 24, 2022

Hello, was there any change with the way asynchronous requests are done on the latest meta package?

I've recently tried migrating my project from riot-api v4.1 to riot-api-base + riot-api-league v1.0. The synchronous requests seem to work correctly, however the promise do not seem to resolve when the requests are called asynchronously.

Here's an example of code I was using with the previous version:

       // fetch an ongoing game
        $game = $api->getCurrentGameInfo($summonerId);
        $summoners = [];
        foreach ($participants as $participant) {
           // fetch the league entries for each of the games participants
            $api->nextAsync(
                function ($entryDto) use ($participant): void {
                    //on success add the participants'LP to the summoners array
                    $summoners[$participant->summonerId] = $entryDto->leaguePoints;
                },
                function (Exception $error) use ($participant): void {
                    // otherwise add null
                    $summoners[$participant->summonerId] = null;
                },
                'entries'
            )->getLeagueEntriesForSummoner($participant->summonerId);
        }
        $this->api->commitAsync('entries');

This was working fine with v4.1, but silently fails on v1.0. Any idea what the reason could be ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant