Skip to main content

BatchParallelismCoordinator

  • Namespace: PPDS.Dataverse.BulkOperations
  • Assembly: PPDS.Dataverse
  • Kind: Class
  • Implements: IDisposable

Summary

Coordinates batch parallelism across all concurrent bulk operations. Ensures total concurrent batches never exceed pool's recommended DOP.

Members

Constructors

BatchParallelismCoordinator(IDataverseConnectionPool pool, Nullable<TimeSpan> acquireTimeout)

BatchParallelismCoordinator(IDataverseConnectionPool pool, Nullable<TimeSpan> acquireTimeout)

Creates a new coordinator tied to the specified connection pool.

  • Param pool: The connection pool to coordinate with.

  • Param acquireTimeout: Maximum time to wait for a batch slot. Defaults to 120 seconds (matching pool timeout).

Methods

AcquireAsync

Task<IAsyncDisposable> AcquireAsync(CancellationToken cancellationToken)

Acquires a batch execution slot. Blocks until slot available or timeout.

  • Param cancellationToken: Cancellation token.

  • Returns: Disposable slot that must be disposed after batch completes.

Dispose

void Dispose()

Disposes the coordinator and releases all resources.

Properties

AvailableSlots

int AvailableSlots { get; }

Gets the number of currently available batch slots.

CurrentCapacity

int CurrentCapacity { get; }

Gets the current batch slot capacity. May expand during throttle recovery as pool DOP increases.