Closed nleroy917 closed 2 years ago
I'm wondering if it would be worth it to custom-write a method that closes all potential connections to the database during garbage collection (__del__) or after execution in a context manager (__exit__).
__del__
__exit__
They both would have a calling syntax similar to:
def __del__(self): self.close_connection()
This way we avoid dangling connections.
I'm wondering if it would be worth it to custom-write a method that closes all potential connections to the database during garbage collection (
__del__
) or after execution in a context manager (__exit__
).They both would have a calling syntax similar to:
This way we avoid dangling connections.