Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Asynchronous requests with v5.0 #6

Description

@chypriote

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 ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions