Limiting the maximum number of parallel executions is a common practice. For instance, when third-party services restrict the number of concurrent calls to their service. This also helps distributing the global concurrency limit into function limits, preventing one function from consuming all the concurrency.

By default, concurrency limit is not configured on background function.


import { defer } from "@defer/client";

async function reIndexElasticRecords() {
  // business logic here

export default defer(reIndexElasticRecords, { concurrency: 1 });