Index: sdk/lib/io/http_impl.dart |
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart |
index c7e1a5f4a714a0a8920e36fb1980fbff6b4a6262..e4f366db1bf47e61c5e423f52e90ff6f7a7a2c1d 100644 |
--- a/sdk/lib/io/http_impl.dart |
+++ b/sdk/lib/io/http_impl.dart |
@@ -2190,7 +2190,17 @@ class _HttpServer |
_sessionManager.sessionTimeout = timeout; |
} |
- void _handleRequest(HttpRequest request) => _controller.add(request); |
+ void _handleRequest(_HttpRequest request) { |
+ // Delay the request until the isolate's message-queue is handled. |
+ // This greatly improves scheduling when a lot of requests are active. |
+ Timer.run(() { |
+ if (!closed) { |
+ _controller.add(request); |
+ } else { |
+ request._httpConnection.destroy(); |
+ } |
+ }); |
+ } |
void _handleError(error) { |
if (!closed) _controller.addError(error); |