sdk-middleware-queue

Middleware to throttle concurrent request to a certain limit. Useful to reduce concurrent HTTP requests.

Install

Node.js

npm install --save @commercetools/sdk-middleware-queue

Browser

<script src="https://unpkg.com/@commercetools/sdk-middleware-queue/dist/commercetools-sdk-middleware-queue.umd.min.js"></script>
<script>
  // global: CommercetoolsSdkMiddlewareQueue
</script>

createQueueMiddleware(options)

Creates a middleware to handle concurrent requests.

Named arguments (options)

  1. concurrency (Number): the max number of concurrent requests (default 20)

Usage example

import { createClient } from '@commercetools/sdk-client'
import { createQueueMiddleware } from '@commercetools/sdk-middleware-queue'

const client = createClient({
  middlewares: [
    createQueueMiddleware({
      concurrency: 5,
    }),
  ],
})

results matching ""

    No results matching ""