# createLimit

> **createLimit**(`concurrency`): [`Limit`](/reference/filoz/synapse-core/utils/type-aliases/limit/)

Defined in: [packages/synapse-core/src/utils/concurrency.ts:22](https://github.com/FilOzone/synapse-sdk/blob/628d3a8812e8612a183a3abe3328169fb741260b/packages/synapse-core/src/utils/concurrency.ts#L22)

Create a limit that runs at most `concurrency` tasks at a time, in call order.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `concurrency` | `number` | The maximum number of tasks running at the same time. `Infinity` means no limit. |

## Returns

[`Limit`](/reference/filoz/synapse-core/utils/type-aliases/limit/)

A function that runs a task when a slot is free and resolves with its result.

## Example

```ts
import { createLimit } from '@filoz/synapse-core/utils'

const limit = createLimit(2)
const results = await Promise.all(urls.map((url) => limit(() => fetch(url))))
```