Giter VIP home page Giter VIP logo

Comments (5)

mtdowling avatar mtdowling commented on May 18, 2024 2

Guzzle (the client) also supports the delay request option which can be used to delay the sending of a request: http://docs.guzzlephp.org/en/stable/request-options.html#delay.

from promises.

alexeyshockov avatar alexeyshockov commented on May 18, 2024

There is no concurrent version of sleep() in Guzzle Promises out of the box. You can take a look at a library (I'm the developer) which integrates Guzzle with React PHP. With React you can use timers to create "sleep promises" (see sleep_fn).

But if you need just delayed retries, try to use the default retry middleware. Also a usage example.

from promises.

sminnee avatar sminnee commented on May 18, 2024

Thanks for the advice. I'll check out the React bridge.

The default retry middleware, uses the Guzzle delay option, which uses a `usleep() call. My understanding is that this would block other requests from being processed in the meantime.

My use-case is a domain scanner, so efficient parallel processing is quite important for its overall performance.

from promises.

mtdowling avatar mtdowling commented on May 18, 2024

Only the blocking handlers use usleep. The CurlMultiHandler does not.

from promises.

abiusx avatar abiusx commented on May 18, 2024

You can use GuzzleHttp to send a request to a non-existing server with a certain delay. This can work as an async sleep.

from promises.

Related Issues (20)

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.