@cluelesscoders/request-pool

Create request pool queue for all types of http request

Usage no npm install needed!

<script type="module">
  import cluelesscodersRequestPool from 'https://cdn.skypack.dev/@cluelesscoders/request-pool';
</script>

README

Request Pool

Creates a pool of request.

Features

  • Axios based request pool
  • Support for all axios request types.

Example

import { RequestPool } from '@cluelesscoders/request-pool';

const targets = [
    { url: 'http://testurl1/', method: 'GET' },
    { url: 'http://testurl2/', method: 'GET' },
    { url: 'http://testurl3/', method: 'POST', data: { test: 'data' } },
];

// limit two request at a time
const poolSize = 2;

const reqPool = new RequestPool(targets, poolSize);

// Get all responses including the failures
const responses = await reqPool.start();