tortoise / aerich

A database migrations tool for TortoiseORM, ready to production.
https://github.com/tortoise/aerich
Apache License 2.0
830 stars 95 forks source link

Aerich Command class never closes Tortoise connections #212

Open pmdevita opened 2 years ago

pmdevita commented 2 years ago

This one had me tearing out my hair for a few hours since I'm still new to Tortoise. If you are using Aerich through the Command class (as mentioned here in the Readme), it doesn't close the Tortoise connections when done, preventing the event loop from properly closing. It isn't immediately obvious that this needs to be done because the developer isn't setting up or managing the Tortoise class themselves here.

I think either Aerich should close the connection for the developer or we should add to the docs that the developer needs to do await Tortoise.close_connections() when they are closing the application.

chobeat commented 2 years ago

same problem, same solution. Thanks a lot