WordPress / WordPress/Requests

Allow setting multi-request concurrency

Open
#266 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Transports
Dominant language
PHP
Stars
3.6k
Forks
500
Avg merge
2d 21h
Merged PRs (30d)
5

Description

With request_multipleis it possible to send multiple requests simultaneously.
Is it possible to set the limit for how many requests will be execute simultaneously?

Because if it's too high, requests are likely to fail more frequently or automated software may perceive as a DOS attack and automatically block further requests.

For example I have an array with 1000 urls

$requests = array( 1000 * array( 'url' => 'http://urlofsitetotest.com/), );
// Setup a callback
function my_callback(&$request, $id) {
	var_dump($id, $request);
}
// Tell Requests to use the callback
$options = array('complete' => 'my_callback',)
// Set 5 requests will be execute simultaneously
// Requests::setSimultaneousLimit(5) => Does option exists ?
// Send the request!
$responses = Requests::request_multiple($requests, $options);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Requests::request_multiple and trace how requests are scheduled and callbacks are handled. Determine where a configurable concurrency limit fits, then verify that the limit caps simultaneous requests while preserving the existing callback behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.