diff --git a/CHANGELOG.md b/CHANGELOG.md index b0f23878..f1157295 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,4 +30,5 @@ replaced with `parseBody`, `parseUploadedFiles`, and `parseRawRequestBuffer`, re * Removed the synchronous equivalents of the above methods (`body`, `files`, and `originalBuffer`), as well as `query`. * Removed `Angel.injections` and `RequestContext.injections`. -* Removed `Angel.inject`. \ No newline at end of file +* Removed `Angel.inject`. +* Removed a dependency on `package:pool`, which also meant removing `AngelHttp.throttle`. \ No newline at end of file diff --git a/lib/src/http/angel_http.dart b/lib/src/http/angel_http.dart index dda37b8f..c4a750fc 100644 --- a/lib/src/http/angel_http.dart +++ b/lib/src/http/angel_http.dart @@ -11,7 +11,6 @@ import 'dart:io' import 'package:angel_http_exception/angel_http_exception.dart'; import 'package:angel_route/angel_route.dart'; import 'package:combinator/combinator.dart'; -import 'package:pool/pool.dart'; import 'package:stack_trace/stack_trace.dart'; import 'package:tuple/tuple.dart'; import 'http_request_context.dart'; @@ -29,8 +28,6 @@ class AngelHttp { Future Function(dynamic, int) _serverGenerator = HttpServer.bind; StreamSubscription _sub; - Pool _pool; - AngelHttp(this.app, {this.useZone: true}); /// The function used to bind this instance to an HTTP server. @@ -323,10 +320,6 @@ class AngelHttp { ..add(outputBuffer); return request.response.close().then((_) { - if (req.injections.containsKey(PoolResource)) { - req.injections[PoolResource].release(); - } - if (!app.isProduction && app.logger != null) { var sw = req.grab(Stopwatch); @@ -343,11 +336,7 @@ class AngelHttp { Future createRequestContext(HttpRequest request) { var path = request.uri.path.replaceAll(_straySlashes, ''); if (path.length == 0) path = '/'; - return HttpRequestContext.from(request, app, path).then((req) { - if (_pool != null) req.inject(PoolResource, _pool.request()); - if (app.injections.isNotEmpty) app.injections.forEach(req.inject); - return req; - }); + return HttpRequestContext.from(request, app, path); } Future createResponseContext(HttpResponse response, @@ -356,12 +345,4 @@ class AngelHttp { response, app, correspondingRequest as HttpRequestContext) ..serializer = (app.serializer ?? json.encode) ..encoders.addAll(app.encoders ?? {})); - - /// Limits the maximum number of requests to be handled concurrently by this instance. - /// - /// You can optionally provide a [timeout] to limit the amount of time a request can be - /// handled before. - void throttle(int maxConcurrentRequests, {Duration timeout}) { - _pool = new Pool(maxConcurrentRequests, timeout: timeout); - } } diff --git a/pubspec.yaml b/pubspec.yaml index 9a7b05b4..d0446987 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,7 +27,6 @@ dependencies: meta: ^1.0.0 mime: ^0.9.3 path: ^1.0.0 - pool: ^1.0.0 stack_trace: ^1.0.0 tuple: ^1.0.0 dev_dependencies: