Properly release resources after HTTP errors.
Release resources for requests that error out. (#2)
This was causing dart-lang/pub#1610
4 files changed
tree: 7eca48afc6d3a4f49d883040fed12e1577e49b72
- lib/
- test/
- .gitignore
- .test_config
- CHANGELOG.md
- codereview.settings
- LICENSE
- pubspec.yaml
- README.md
README.md
http_throttle
is middleware for the http package that throttles the number of concurrent requests that an HTTP client can make.
// This client allows 32 concurrent requests.
final client = new ThrottleClient(32);
Future<List<String>> readAllUrls(Iterable<Uri> urls) {
return Future.wait(urls.map((url) {
// You can safely call as many client methods as you want concurrently, and
// ThrottleClient will ensure that only 32 underlying HTTP requests will be
// open at once.
return client.read(url);
}));
}