warmup method

Future<void> warmup([
  1. int? count
])

Pre-creates idle connections up to count, or Minimum Pool Size when omitted. This is explicit because Dart constructors cannot await.

Implementation

Future<void> warmup([int? count]) async {
  _throwIfDisposed();
  if (!pooling) {
    return;
  }

  final target = (count ?? minPoolSize).clamp(0, maxPoolSize);
  while (_connectors.length < target) {
    final pooled = await _openNewPooledConnector(wasReused: false);
    pooled.lastReturnedAt = DateTime.now();
    _idleConnectors.add(pooled);
  }
}