From 8187045754e6123e449e8d7387492e21db9c2adc Mon Sep 17 00:00:00 2001 From: thosakwe Date: Mon, 24 Apr 2017 22:44:22 -0400 Subject: [PATCH] +1 --- .idea/workspace.xml | 191 +++++++++++++++++++------------ README.md | 2 +- lib/src/http/hooked_service.dart | 1 + lib/src/http/server.dart | 6 +- lib/src/http/service.dart | 3 + pubspec.yaml | 2 +- 6 files changed, 124 insertions(+), 81 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c7b6016a..040d56bd 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,9 +4,9 @@ - - + + @@ -31,8 +31,8 @@ - - + + @@ -41,7 +41,7 @@ - + @@ -50,11 +50,21 @@ - + - - + + + + + + + + + + + + @@ -63,25 +73,45 @@ - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + @@ -121,6 +151,7 @@ end reopen REDIRECT + close( _isClosed @@ -136,17 +167,18 @@ @@ -157,7 +189,7 @@ DEFINITION_ORDER - @@ -392,7 +424,8 @@ - + + 1481237183504 @@ -443,13 +476,17 @@ - - - - @@ -459,6 +496,9 @@ + + + @@ -479,7 +519,7 @@ - @@ -491,23 +531,22 @@ - - + - + - + - - - + + + + - @@ -530,7 +569,8 @@ - @@ -804,13 +844,6 @@ - - - - - - - @@ -841,7 +874,7 @@ - + @@ -857,14 +890,6 @@ - - - - - - - - @@ -877,7 +902,7 @@ - + @@ -885,36 +910,42 @@ - - - - - - - - - - - - + + - - + + - + - - + + + + + + + + + + + + + + + + + + @@ -923,19 +954,29 @@ - + - + - + - - + + + + + + + + + + + + diff --git a/README.md b/README.md index bbc09c1a..ccd3cd30 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # angel_framework -[![pub 1.0.2](https://img.shields.io/badge/pub-1.0.2-brightgreen.svg)](https://pub.dartlang.org/packages/angel_framework) +[![pub 1.0.2+1](https://img.shields.io/badge/pub-1.0.2+1-brightgreen.svg)](https://pub.dartlang.org/packages/angel_framework) [![build status](https://travis-ci.org/angel-dart/framework.svg)](https://travis-ci.org/angel-dart/framework) A high-powered HTTP server with support for dependency injection, sophisticated routing and more. diff --git a/lib/src/http/hooked_service.dart b/lib/src/http/hooked_service.dart index dadda43d..c4722f3a 100644 --- a/lib/src/http/hooked_service.dart +++ b/lib/src/http/hooked_service.dart @@ -66,6 +66,7 @@ class HookedService extends Service { } /// Closes any open [StreamController]s on this instance. **Internal use only**. + @override Future close() async { _ctrl.forEach((c) => c.close()); beforeIndexed._close(); diff --git a/lib/src/http/server.dart b/lib/src/http/server.dart index b52a2bef..1980106a 100644 --- a/lib/src/http/server.dart +++ b/lib/src/http/server.dart @@ -200,10 +200,8 @@ class Angel extends AngelBase { _fatalErrorStream.close(); _onController.close(); - await Future.forEach(services.keys, (Service service) async { - if (service is HookedService) { - await service.close(); - } + await Future.forEach(services.values, (Service service) async { + await service.close(); }); for (var plugin in justBeforeStop) await plugin(this); diff --git a/lib/src/http/service.dart b/lib/src/http/service.dart index 5cee5774..162f675b 100644 --- a/lib/src/http/service.dart +++ b/lib/src/http/service.dart @@ -40,6 +40,9 @@ class Service extends Routable { /// The [Angel] app powering this service. AngelBase app; + /// Closes this service, including any database connections or stream controllers. + Future close() async {} + /// Retrieves all resources. Future index([Map params]) { throw new AngelHttpException.methodNotAllowed(); diff --git a/pubspec.yaml b/pubspec.yaml index 32df2ec1..bf3df3b6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_framework -version: 1.0.2 +version: 1.0.2+1 description: A high-powered HTTP server with DI, routing and more. author: Tobe O homepage: https://github.com/angel-dart/angel_framework