Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.
Docs menu / Basic Concurrency

Basic Concurrency

Concurrency Options

Effect provides options to manage how effects are executed, particularly focusing on controlling how many effects run concurrently.

type Options = {
readonly concurrency?: Concurrency
}

The concurrency option is used to determine the level of concurrency, with the following values:

type Concurrency = number | "unbounded" | "inherit"

Let’s explore each configuration in detail.

Sequential Execution (Default)

By default, if you don’t specify any concurrency option, effects will run sequentially, one after the other. This means each effect starts only after the previous one completes.

Example (Sequential Execution)

import { Effect, Duration } from "effect"
// Helper function to simulate a task with a delay
const makeTask = (n: number, delay: Duration.DurationInput) =>
Effect.promise(
() =>
new Promise<void>((resolve) => {
console.log(`start task${n}`) // Logs when the task starts
setTimeout(() => {