Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Метод __exit__ в Uow #1

Open
rbird404 opened this issue Apr 25, 2024 · 0 comments
Open

Метод __exit__ в Uow #1

rbird404 opened this issue Apr 25, 2024 · 0 comments

Comments

@rbird404
Copy link

rbird404 commented Apr 25, 2024

В этом случае rollback разве не всегда выполняется?

async def __aexit__(self, *args):
        """Закрытие контекста и откат на случай ошибки."""
        self._session.expunge_all()
        await self.rollback()
        await self._session.close()
        self._inside_context_manager = False

Возможно, должны быть так?

 async def __aexit__(self, exc_type, exc_value, exc_tb):
        """Закрытие контекста и откат на случай ошибки."""
        if exc_type is not None:
            await self.rollback()
            return True  # Исключение было обработано

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant