nextAvailableRunner property

Future<AsyncRunner> get nextAvailableRunner

Implementation

Future<AsyncRunner> get nextAvailableRunner async {
  AsyncRunner asyncRunner = asyncRunners.first;
  int j = await asyncRunner.numInFlightRequests();
  for (int i = 1; j != 0 && i < asyncRunners.length; i++) {
    final runner = asyncRunners[i];
    final k = await runner.numInFlightRequests();
    if (k < j) {
      asyncRunner = runner;
      j = k;
    }
  }
  return asyncRunner;
}