-
-
Notifications
You must be signed in to change notification settings - Fork 117
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 sleep #71
Comments
There is no concurrent version of But if you need just delayed retries, try to use the default retry middleware. Also a usage example. |
Guzzle (the client) also supports the |
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. |
Only the blocking handlers use usleep. The CurlMultiHandler does not. |
You can use GuzzleHttp to send a request to a non-existing server with a certain delay. This can work as an async sleep. |
CurlMultiHandler uses usleep too: https://github.com/guzzle/guzzle/blob/7.8/src/Handler/CurlMultiHandler.php#L187 |
I was building some async code that triggers a delayed retry in the case of an error, similar to:
Of course,
sleep(5)
is blocking. Is there an asynchronous equivalent for sleep, such as a promise that will resolve within await()
call after the given amount of time? If not, can one be added to the library?The text was updated successfully, but these errors were encountered: