processHandlerWithResults method

Future<Results> processHandlerWithResults(
  1. Handler handler,
  2. Duration timeout
)

Implementation

Future<Results> processHandlerWithResults(Handler handler, Duration timeout) {
  return pool.withResource(() async {
    try {
      var results =
          await _processHandler<ResultsStream>(handler).timeout(timeout);
      // Read all of the results. This is so we can close the handler before returning to the
      // user. Obviously this is not super efficient but it guarantees correct api use.
      var ret = await Results._read(results).timeout(timeout);
      return ret;
    } finally {
      _handler = null;
    }
  });
}