processQueue method

void processQueue()

Implementation

void processQueue() {
  for (var i = 0; i < _pendingJobs.length; i++) {
    final IsolateAction job = _pendingJobs[i];

    if (_runningJobs.length >= concurrents) {
      break;
    }

    _pendingJobs.removeAt(i);
    _runningJobs.add(job);

    Future future = job.run();

    future.then((value) {
      onJobFinished(job);
    }).catchError((error, stackTrace) {
      _hasError = true;
      exceptions.add(error);

      onJobFinished(job);
    });
  }
}