Git Product home page Git Product logo

Comments (4)

dolejska-daniel avatar dolejska-daniel commented on June 28, 2024

Hello, thank you for your interest in this library! The commitAsync method is synchronous and always will be, that is the intended behaviour - PHP is not natively asynchronous hence what you're describing can never really occur (ReactPHP allows for event-driven programming to occur in PHP however the code doesn't run in parallel or asynchronously - or at least as far as I know, I'm not too familiar with ReactPHP).
However, you can use the event loop of ReactPHP to invoke methods kind of asynchronously. Check out this code snippet showing how to use ReactPHP's event loop within the Guzzle library. Furthermore, keep in mind that commitAsync will always block since that is when the request promises are being waited for.

from riot-api-league.

sunnyphp avatar sunnyphp commented on June 28, 2024

So there are no plans to make the library non-blocking?

from riot-api-league.

dolejska-daniel avatar dolejska-daniel commented on June 28, 2024

This is the least blocking it can be, I guess. You can make Guzzle use the ReactPHP's event loop and move the commitAsync to some "asynchronous" function called from the event loop too. That way, you can achieve some level of asynchronicity. However, PHP is not asynchronous; hence, true asynchronicity cannot be achieved - some function will always block.

from riot-api-league.

sunnyphp avatar sunnyphp commented on June 28, 2024

I will do so. Blocking data loading takes most of the time. A lot of useful work can be done while waiting for a response from the Riot API. Thank you.

from riot-api-league.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.