Skip to content

Commit

Permalink
Always add the store to lifespan_manager then let the store implement…
Browse files Browse the repository at this point in the history
…ation decides to handle to close or not
  • Loading branch information
euri10 committed Feb 14, 2024
1 parent 702d5ef commit 545fe54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions litestar/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,7 @@ def __init__(
)
self._lifespan_managers = config.lifespan
for store in self.stores._stores.values():
if store.handle_client_shutdown:
self._lifespan_managers.append(store)
self._lifespan_managers.append(store)
self._server_lifespan_managers = [p.server_lifespan for p in config.plugins or [] if isinstance(p, CLIPlugin)]
self.experimental_features = frozenset(config.experimental_features or [])
self.get_logger: GetLogger = get_logger_placeholder
Expand Down
3 changes: 2 additions & 1 deletion litestar/stores/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def __init__(
)

async def _shutdown(self) -> None:
await self._redis.aclose(close_connection_pool=True)
if self.handle_client_shutdown:
await self._redis.aclose(close_connection_pool=True)

async def __aexit__(
self,
Expand Down

0 comments on commit 545fe54

Please sign in to comment.