From 5a401b775b216435a519b499080f30d5d6130d81 Mon Sep 17 00:00:00 2001 From: Justin Arthur Date: Fri, 15 May 2020 00:48:02 -0500 Subject: [PATCH] Fix StopAsyncIteration exception if closing subscribed sessions. 1.0.1 --- CHANGELOG.md | 3 +++ serverwamp/application.py | 15 ++++++++++----- setup.py | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 011a61d..c785e2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # serverwamp Changelog +## 1.0.1 +* Fix stopasynciteration exception on session close with outstanding subscriptions. + ## 1.0.0 Brand new API with… * Support for multiple realms w/ separate handlers diff --git a/serverwamp/application.py b/serverwamp/application.py index 7c6f549..0f57084 100644 --- a/serverwamp/application.py +++ b/serverwamp/application.py @@ -322,11 +322,16 @@ async def handle_connection(self, connection): finally: state_iters = self._session_state_exits.pop(session, EMPTY_SET) if state_iters: - async with ( - self._async_support.launch_task_group() - ) as exit_tasks: - for state_iter in state_iters: - await exit_tasks.spawn(state_iter.__anext__) + # TODO, make exits concurrent + for state_iter in state_iters: + try: + await state_iter.__anext__() + except StopAsyncIteration: + pass + else: + # TODO: throw exception because there should only + # be one more iteration. + pass # Default Realm Configuration… def set_authentication_handler( diff --git a/setup.py b/setup.py index 12f2658..a69bacf 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='serverwamp', - version='1.0.0', + version='1.0.1', description=('Components that add Web Application Messaging Protocol ' 'features to WebSocket servers.'), long_description=open('README.md').read(),