ConcurrencyControl class
Concurrency control to limit parallel task executions.
Prevent overwhelming servers or hitting rate limits by limiting how many tasks can run in parallel.
Example:
// Max 3 uploads at once
await TaskFlow.enqueue(
'uploadFile',
concurrency: 3,
);
Constructors
- ConcurrencyControl({required int maxConcurrent, ConcurrencyStrategy strategy = ConcurrencyStrategy.fifo})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxConcurrent → int
-
Maximum number of tasks that can run in parallel
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strategy → ConcurrencyStrategy
-
Priority queue strategy (default: FIFO)
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Convert to map
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- liberal → const ConcurrencyControl
- limited → const ConcurrencyControl
- moderate → const ConcurrencyControl
- single → const ConcurrencyControl
- Common presets