You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apologies for the (very) late reply, this issue slipped under my radar.
To perform multiple queries simultaneously (or multiple of any operation which will await I/O), use Amp\async() in conjunction with Amp\Future\await() to await the set of futures created from async().
$listOfDomains = [...]; // List of domain names to query.$futures = [];
foreach ($listOfDomainsas$domain) {
$futures[$domain] = Amp\async(Dns\resolve(...), $domain);
}
$resolvedRecords = Amp\Future\await($futures);
Note it may not be a good idea to initiate 500 DNS requests simultaneously. As with many simultaneous async operations, it may be a good idea to throttle the number of simultaneous requests in-flight. See amphp/sync and amphp/pipeline for tools to do just this.
Can you please share a link to example of async dns query loop of 500 domains for example.
Of course, simply changing
Dns\resolve($domain)
in/examples/benchmark.php
to:doesn't make any difference.
The text was updated successfully, but these errors were encountered: