diff --git a/docs/docs/release_notes.md b/docs/docs/release_notes.md index 47a49f3..59aabd6 100644 --- a/docs/docs/release_notes.md +++ b/docs/docs/release_notes.md @@ -1,3 +1,6 @@ +### 4.0.1 +- Fix an issue in `startup` lifespan + ### 4.0.0 - Move `database` and `redis` connections from `MIDDLEWARES` to their own block, `DATABASE` and `REDIS` - Make `Database` queries `async` diff --git a/panther/__init__.py b/panther/__init__.py index fcb1cf4..dcfa61b 100644 --- a/panther/__init__.py +++ b/panther/__init__.py @@ -1,6 +1,6 @@ from panther.main import Panther # noqa: F401 -__version__ = '4.0.0' +__version__ = '4.0.1' def version(): diff --git a/panther/base_websocket.py b/panther/base_websocket.py index 5ba79e6..587fecb 100644 --- a/panther/base_websocket.py +++ b/panther/base_websocket.py @@ -182,10 +182,9 @@ async def start(self): but they have same Manager() """ - if config.HAS_WS: - # Schedule the async function to run in the background, - # We don't need to await for this task - asyncio.create_task(self()) + # Schedule the async function to run in the background, + # We don't need to await for this task + asyncio.create_task(self()) @classmethod async def handle_authentication(cls, connection: Websocket): diff --git a/panther/main.py b/panther/main.py index a4a6cd9..109d4a5 100644 --- a/panther/main.py +++ b/panther/main.py @@ -70,7 +70,8 @@ async def __call__(self, scope: dict, receive: Callable, send: Callable) -> None if scope['type'] == 'lifespan': message = await receive() if message["type"] == 'lifespan.startup': - await config.WEBSOCKET_CONNECTIONS.start() + if config.HAS_WS: + await config.WEBSOCKET_CONNECTIONS.start() await Event.run_startups() elif message["type"] == 'lifespan.shutdown': # It's not happening :\, so handle the shutdowns in __del__ ...